Changes in directory llvm/lib/Transforms/Scalar:
PredicateSimplifier.cpp updated: 1.45 -> 1.46 --- Log message: If we know that it's a constant being casted, propagate through the cast instruction. Doesn't work the other way though (can't recover bits that have been truncated). --- Diffs of the changes: (+10 -1) PredicateSimplifier.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.45 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.46 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.45 Thu Jan 11 18:02:12 2007 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Thu Jan 11 19:23:53 2007 @@ -1285,8 +1285,17 @@ IG.canonicalize(SI->getFalseValue(), Top)) { add(SI, SI->getTrueValue(), ICmpInst::ICMP_EQ, NewContext); } + } else if (CastInst *CI = dyn_cast<CastInst>(I)) { + if (CI->getDestTy()->isFPOrFPVector()) return; + + if (Constant *C = dyn_cast<Constant>( + IG.canonicalize(CI->getOperand(0), Top))) { + add(CI, ConstantExpr::getCast(CI->getOpcode(), C, CI->getDestTy()), + ICmpInst::ICMP_EQ, NewContext); + } + + // TODO: "%a = cast ... %b" where %b is NE/LT/GT a constant. } - // TODO: CastInst "%a = cast ... %b" where %b is EQ or NE a constant. } /// solve - process the work queue _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits