diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-17 01:22:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-17 01:22:39 +0000 |
commit | b50f5a46e06e82bd7b0f2f63e4eae1d7b6ea6868 (patch) | |
tree | 0d74b3727d8e59c0fd6a1d909cd283c9e3c70a36 /llvm/lib/Analysis | |
parent | 722848dc0186b66568d8bb0c2b5c41360d8a0162 (diff) | |
download | bcm5719-llvm-b50f5a46e06e82bd7b0f2f63e4eae1d7b6ea6868.tar.gz bcm5719-llvm-b50f5a46e06e82bd7b0f2f63e4eae1d7b6ea6868.zip |
Fix ScalarEvolution's Xor handling to not assume that an And
that gets recognized with a SCEVZeroExtendExpr must be an And
with a low-bits mask. With r73540, this is no longer the case.
llvm-svn: 73594
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 3731fdfc712..2546e81952b 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2453,9 +2453,12 @@ SCEVHandle ScalarEvolution::createSCEV(Value *V) { if (BO->getOpcode() == Instruction::And && LCI->getValue() == CI->getValue()) if (const SCEVZeroExtendExpr *Z = - dyn_cast<SCEVZeroExtendExpr>(getSCEV(U->getOperand(0)))) - return getZeroExtendExpr(getNotSCEV(Z->getOperand()), - U->getType()); + dyn_cast<SCEVZeroExtendExpr>(getSCEV(U->getOperand(0)))) { + SCEVHandle ZO = Z->getOperand(); + if (APIntOps::isMask(getTypeSizeInBits(ZO->getType()), + CI->getValue())) + return getZeroExtendExpr(getNotSCEV(ZO), U->getType()); + } } break; |