Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
// some N^2 behavior in pathological cases. | // some N^2 behavior in pathological cases. | ||||
ICWorklist.reserve(InstrsForInstCombineWorklist.size()); | ICWorklist.reserve(InstrsForInstCombineWorklist.size()); | ||||
for (Instruction *Inst : reverse(InstrsForInstCombineWorklist)) { | for (Instruction *Inst : reverse(InstrsForInstCombineWorklist)) { | ||||
// DCE instruction if trivially dead. As we iterate in reverse program | // DCE instruction if trivially dead. As we iterate in reverse program | ||||
// order here, we will clean up whole chains of dead instructions. | // order here, we will clean up whole chains of dead instructions. | ||||
if (isInstructionTriviallyDead(Inst, TLI)) { | if (isInstructionTriviallyDead(Inst, TLI)) { | ||||
++NumDeadInst; | ++NumDeadInst; | ||||
LLVM_DEBUG(dbgs() << "IC: DCE: " << *Inst << '\n'); | LLVM_DEBUG(dbgs() << "IC: DCE: " << *Inst << '\n'); | ||||
salvageDebugInfoOrMarkUndef(*Inst); | salvageDebugInfo(*Inst); | ||||
Inst->eraseFromParent(); | Inst->eraseFromParent(); | ||||
MadeIRChange = true; | MadeIRChange = true; | ||||
continue; | continue; | ||||
} | } | ||||
ICWorklist.push(Inst); | ICWorklist.push(Inst); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |