diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-10-06 23:43:06 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-10-06 23:43:06 +0000 |
commit | 72d339abb770cd36135c06167b55ef052710636d (patch) | |
tree | 3abc0c4a6e91ac0370f3797f9d4676b8bf06b16f /llvm/lib/Transforms | |
parent | c54d5b16d522fb79bbb147091c249db5a8067e0b (diff) | |
download | bcm5719-llvm-72d339abb770cd36135c06167b55ef052710636d.tar.gz bcm5719-llvm-72d339abb770cd36135c06167b55ef052710636d.zip |
[InstCombine] use correct type when propagating constant condition in simplifyDivRemOfSelectWithZeroOp (PR34856)
llvm-svn: 315130
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 4290d8db989..96a5187e1cf 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -813,7 +813,7 @@ bool InstCombiner::simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I) { // Scan the current block backward, looking for other uses of SI. BasicBlock::iterator BBI = I.getIterator(), BBFront = I.getParent()->begin(); - + Type *CondTy = SelectCond->getType(); while (BBI != BBFront) { --BBI; // If we found a call to a function, we can't assume it will return, so @@ -828,7 +828,8 @@ bool InstCombiner::simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I) { *I = SI->getOperand(NonNullOperand); Worklist.Add(&*BBI); } else if (*I == SelectCond) { - *I = Builder.getInt1(NonNullOperand == 1); + *I = NonNullOperand == 1 ? ConstantInt::getTrue(CondTy) + : ConstantInt::getFalse(CondTy); Worklist.Add(&*BBI); } } |