diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-08 19:28:47 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-08 19:28:47 +0000 |
| commit | 9242ae047c4c061c0501d626e5e372f11b5877bc (patch) | |
| tree | c7e47d2e779ea5402d37008b9e99dfe952dd2921 /llvm/lib/Transforms | |
| parent | b3ed45b67cec6e82ab3c8247f02b52cf234172fb (diff) | |
| download | bcm5719-llvm-9242ae047c4c061c0501d626e5e372f11b5877bc.tar.gz bcm5719-llvm-9242ae047c4c061c0501d626e5e372f11b5877bc.zip | |
mplement a theoretical fixme.
llvm-svn: 93024
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index a1d6d29ecd4..be18311846c 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -476,9 +476,13 @@ static unsigned CanEvaluateSExtd(Value *V, const Type *Ty, /// insert the code to evaluate the expression. Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned) { - // FIXME: use libanalysis constant folding. - if (Constant *C = dyn_cast<Constant>(V)) - return ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/); + if (Constant *C = dyn_cast<Constant>(V)) { + C = ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/); + // If we got a constantexpr back, try to simplify it with TD info. + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) + C = ConstantFoldConstantExpression(CE, TD); + return C; + } // Otherwise, it must be an instruction. Instruction *I = cast<Instruction>(V); |

