[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
Thu Feb 1 07:32:21 PST 2024
================
@@ -2770,15 +2770,31 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
return false;
}
+void llvm::handleUnreachableTerminator(Instruction *I) {
+ // RemoveDIs: erase debug-info on this instruction manually.
+ I->dropDbgValues();
+ unsigned Opcode = I->getOpcode();
+ if (Opcode >= Instruction::Ret && Opcode <= Instruction::Invoke &&
+ I->getNumOperands() > 0) {
+ unsigned OpNum = isa<InvokeInst>(I) ? I->getNumOperands() - 1 : 0;
----------------
nikic wrote:
You should loop over `I->operands()` here, not only update a single operand.
https://github.com/llvm/llvm-project/pull/78444
More information about the llvm-commits
mailing list