[llvm] [InstCombine] If inst in unreachable refers to an inst change it to poison (#65107) (PR #78444)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 05:42:28 PST 2024
================
@@ -2762,15 +2762,30 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
return false;
}
+bool llvm::handleUnreachableTerminator(Instruction *I) {
+ bool Changed = false;
+ // RemoveDIs: erase debug-info on this instruction manually.
+ I->dropDbgValues();
+ for (Use &U : I->operands()) {
+ Value *Op = U.get();
+ if (isa<Instruction>(Op) && !Op->getType()->isTokenTy()) {
----------------
nikic wrote:
Also check that the value is not already poison here, otherwise we may set Changed incorrectly.
https://github.com/llvm/llvm-project/pull/78444
More information about the llvm-commits
mailing list