diff options
| author | Chad Rosier <mcrosier@codeaurora.org> | 2014-10-09 20:06:29 +0000 |
|---|---|---|
| committer | Chad Rosier <mcrosier@codeaurora.org> | 2014-10-09 20:06:29 +0000 |
| commit | bd64d46188bd8f5e7418966d995cf977f18fb336 (patch) | |
| tree | 8275f077253366609044c9da90d020d2fde2c82b /llvm/lib/Transforms/Scalar/Reassociate.cpp | |
| parent | 2c3778dc51512420364910a7af3ccc890661687f (diff) | |
| download | bcm5719-llvm-bd64d46188bd8f5e7418966d995cf977f18fb336.tar.gz bcm5719-llvm-bd64d46188bd8f5e7418966d995cf977f18fb336.zip | |
[Reassociate] Don't canonicalize X - undef to X + (-undef).
Phabricator Revision: http://reviews.llvm.org/D5674
PR21205
llvm-svn: 219434
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index b8fb25d0b9a..0d5ad7311fb 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -967,6 +967,10 @@ static bool ShouldBreakUpSubtract(Instruction *Sub) { if (BinaryOperator::isNeg(Sub) || BinaryOperator::isFNeg(Sub)) return false; + // Don't breakup X - undef. + if (isa<UndefValue>(Sub->getOperand(1))) + return false; + // Don't bother to break this up unless either the LHS is an associable add or // subtract or if this is only used by one. Value *V0 = Sub->getOperand(0); |

