[llvm] a9ddcd6 - [InstCombine] Erase old add when optimizing add overflow
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 11:20:25 PDT 2020
Author: Nikita Popov
Date: 2020-03-29T20:20:14+02:00
New Revision: a9ddcd6411bcbffe551641a91413c417de491189
URL: https://github.com/llvm/llvm-project/commit/a9ddcd6411bcbffe551641a91413c417de491189
DIFF: https://github.com/llvm/llvm-project/commit/a9ddcd6411bcbffe551641a91413c417de491189.diff
LOG: [InstCombine] Erase old add when optimizing add overflow
We don't return the replaceInstUsesWith() result, so we're
responsible for cleaning up.
NFC apart from worklist order changes.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index f36dcacdad28..259481041302 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5618,6 +5618,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
OptimizeOverflowCheck(Instruction::Add, /*Signed*/ false, A, B, *AddI,
Result, Overflow)) {
replaceInstUsesWith(*AddI, Result);
+ eraseInstFromFunction(*AddI);
return replaceInstUsesWith(I, Overflow);
}
}
More information about the llvm-commits
mailing list