summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2018-06-05 14:10:55 +0000
committerJohn Brawn <john.brawn@arm.com>2018-06-05 14:10:55 +0000
commite4ff0bd401ba3e7c61b5a913e9e08fa68bee69b1 (patch)
treede4a3c328b68799167ea261ab3419373d34e8e60 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parentd41bc70094c49fa58ce96141caa63fa5d8f95ef4 (diff)
downloadbcm5719-llvm-e4ff0bd401ba3e7c61b5a913e9e08fa68bee69b1.tar.gz
bcm5719-llvm-e4ff0bd401ba3e7c61b5a913e9e08fa68bee69b1.zip
[InstCombine] Correct the cmp operand type used when canonicalizing abs/nabs
When adjusting a cmp in order to canonicalize an abs/nabs select pattern we need to use the type of the existing operand when creating a new operand not the type of a select operand, as the two may be different. This fixes PR37686. llvm-svn: 334019
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index e70078a73c5..c88270fa0ea 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -818,7 +818,7 @@ static Instruction *canonicalizeAbsNabs(SelectInst &Sel, ICmpInst &Cmp,
// Create the canonical compare.
Cmp.setPredicate(ICmpInst::ICMP_SLT);
- Cmp.setOperand(1, ConstantInt::getNullValue(LHS->getType()));
+ Cmp.setOperand(1, ConstantInt::getNullValue(Cmp.getOperand(0)->getType()));
// If the select operands do not change, we're done.
Value *TVal = Sel.getTrueValue();
OpenPOWER on IntegriCloud