[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
Tue Feb 13 05:26:07 PST 2024
================
@@ -2770,15 +2770,32 @@ 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) {
+ for (unsigned i = 0; i < I->getNumOperands(); i++) {
----------------
nikic wrote:
```suggestion
for (Use &U : I->operands())
```
and then `U.set()`.
https://github.com/llvm/llvm-project/pull/78444
More information about the llvm-commits
mailing list