[llvm] r297046 - NewGVN: Only call isInstructionTrivially dead once per instruction.
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 10:42:27 PST 2017
Author: dannyb
Date: Mon Mar 6 12:42:27 2017
New Revision: 297046
URL: http://llvm.org/viewvc/llvm-project?rev=297046&view=rev
Log:
NewGVN: Only call isInstructionTrivially dead once per instruction.
Modified:
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=297046&r1=297045&r2=297046&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Mon Mar 6 12:42:27 2017
@@ -1730,6 +1730,16 @@ std::pair<unsigned, unsigned> NewGVN::as
}
for (auto &I : *B) {
+ // There's no need to call isInstructionTriviallyDead more than once on
+ // an instruction. Therefore, once we know that an instruction is dead
+ // we change its DFS number so that it doesn't get value numbered.
+ if (isInstructionTriviallyDead(&I, TLI)) {
+ InstrDFS[&I] = 0;
+ DEBUG(dbgs() << "Skipping trivially dead instruction " << I << "\n");
+ markInstructionForDeletion(&I);
+ continue;
+ }
+
InstrDFS[&I] = End++;
DFSToInstr.emplace_back(&I);
}
@@ -1800,15 +1810,6 @@ void NewGVN::valueNumberMemoryPhi(Memory
// congruence finding, and updating mappings.
void NewGVN::valueNumberInstruction(Instruction *I) {
DEBUG(dbgs() << "Processing instruction " << *I << "\n");
- // There's no need to call isInstructionTriviallyDead more than once on
- // an instruction. Therefore, once we know that an instruction is dead
- // we change its DFS number so that it doesn't get numbered again.
- if (InstrDFS[I] != 0 && isInstructionTriviallyDead(I, TLI)) {
- InstrDFS[I] = 0;
- DEBUG(dbgs() << "Skipping unused instruction\n");
- markInstructionForDeletion(I);
- return;
- }
if (!I->isTerminator()) {
const Expression *Symbolized = nullptr;
if (DebugCounter::shouldExecute(VNCounter)) {
More information about the llvm-commits
mailing list