diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2007-01-12 01:23:53 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2007-01-12 01:23:53 +0000 |
commit | ee32ee0250ee0ff4d8260c57853fc0467409b458 (patch) | |
tree | 0f08bf3f50242a3c2a87a2ee06938df72f4fe3f0 /llvm/lib | |
parent | 4a74a75bbb9442c537fcea4bc167c53ae2d52846 (diff) | |
download | bcm5719-llvm-ee32ee0250ee0ff4d8260c57853fc0467409b458.tar.gz bcm5719-llvm-ee32ee0250ee0ff4d8260c57853fc0467409b458.zip |
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).
llvm-svn: 33104
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp b/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp index 8defb871b76..33dee090986 100644 --- a/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -1285,8 +1285,17 @@ namespace { 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 |