diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-29 05:31:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-29 05:31:25 +0000 |
commit | 3607f4d21791d7b82739bb3797f52d2f199e476b (patch) | |
tree | 58373c0ed885c38d19bbb3e350794860c0a6f796 /lib/Transforms/ExprTypeConvert.cpp | |
parent | 7219a21138c61efdd1d1942173113423a63b192b (diff) |
Fix test: Transforms/LevelRaise/2003-11-28-IllegalTypeConversion.ll
Some gep generalization changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/ExprTypeConvert.cpp')
-rw-r--r-- | lib/Transforms/ExprTypeConvert.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 970be52aa4..518a548927 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -257,7 +257,6 @@ bool ExpressionConvertibleToType(Value *V, const Type *Ty, // and we could convert this to an appropriate GEP for the new type. // if (GEP->getNumOperands() == 2 && - GEP->getOperand(1)->getType() == Type::LongTy && GEP->getType() == PointerType::get(Type::SByteTy)) { // Do not Check to see if our incoming pointer can be converted @@ -285,7 +284,6 @@ bool ExpressionConvertibleToType(Value *V, const Type *Ty, // getelemenptr [[int] *] * %reg115, long %reg138 ; [int]** // if (GEP->getNumOperands() == 2 && - GEP->getOperand(1)->getType() == Type::LongTy && PTy->getElementType()->isSized() && TD.getTypeSize(PTy->getElementType()) == TD.getTypeSize(GEP->getType()->getElementType())) { @@ -466,11 +464,10 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC, } if (Res == 0 && GEP->getNumOperands() == 2 && - GEP->getOperand(1)->getType() == Type::LongTy && GEP->getType() == PointerType::get(Type::SByteTy)) { // Otherwise, we can convert a GEP from one form to the other iff the - // current gep is of the form 'getelementptr [sbyte]*, unsigned N + // current gep is of the form 'getelementptr sbyte*, unsigned N // and we could convert this to an appropriate GEP for the new type. // const PointerType *NewSrcTy = PointerType::get(PVTy); @@ -774,8 +771,12 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty, TD.getTypeSize(ElTy) != TD.getTypeSize(I->getOperand(0)->getType())) return false; - // Can convert store if the incoming value is convertible... - return ExpressionConvertibleToType(I->getOperand(0), ElTy, CTMap, TD); + // Can convert store if the incoming value is convertible and if the + // result will preserve semantics... + const Type *Op0Ty = I->getOperand(0)->getType(); + if (!(Op0Ty->isIntegral() ^ ElTy->isIntegral()) && + !(Op0Ty->isFloatingPoint() ^ ElTy->isFloatingPoint())) + return ExpressionConvertibleToType(I->getOperand(0), ElTy, CTMap, TD); } return false; } |