[llvm-commits] [llvm] r93024 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Chris Lattner
sabre at nondot.org
Fri Jan 8 11:28:47 PST 2010
Author: lattner
Date: Fri Jan 8 13:28:47 2010
New Revision: 93024
URL: http://llvm.org/viewvc/llvm-project?rev=93024&view=rev
Log:
mplement a theoretical fixme.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=93024&r1=93023&r2=93024&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Fri Jan 8 13:28:47 2010
@@ -476,9 +476,13 @@
/// 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);
More information about the llvm-commits
mailing list