diff options
Diffstat (limited to 'llvm/lib')
-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); |