|
69 | 69 | #include "llvm/Support/Compiler.h" |
70 | 70 | #include "llvm/Support/Debug.h" |
71 | 71 | #include "llvm/Support/raw_ostream.h" |
| 72 | +#include "llvm/Transforms/Utils/AssumeBundleBuilder.h" |
72 | 73 | #include "llvm/Transforms/Utils/BasicBlockUtils.h" |
73 | 74 | #include "llvm/Transforms/Utils/Local.h" |
74 | 75 | #include "llvm/Transforms/Utils/SSAUpdater.h" |
@@ -875,7 +876,7 @@ void GVNPass::printPipeline( |
875 | 876 | OS << '>'; |
876 | 877 | } |
877 | 878 |
|
878 | | -void GVNPass::doInstructionDeletion(Instruction *I) { |
| 879 | +void GVNPass::salvageAndRemoveInstruction(Instruction *I) { |
879 | 880 | salvageKnowledge(I, AC); |
880 | 881 | salvageDebugInfo(*I); |
881 | 882 | removeInstruction(I); |
@@ -1580,7 +1581,7 @@ void GVNPass::eliminatePartiallyRedundantLoad( |
1580 | 1581 | return OptimizationRemark(DEBUG_TYPE, "LoadPRE", Load) |
1581 | 1582 | << "load eliminated by PRE"; |
1582 | 1583 | }); |
1583 | | - doInstructionDeletion(Load); |
| 1584 | + salvageAndRemoveInstruction(Load); |
1584 | 1585 | } |
1585 | 1586 |
|
1586 | 1587 | bool GVNPass::PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, |
@@ -1799,7 +1800,7 @@ bool GVNPass::PerformLoadPRE(LoadInst *Load, AvailValInBlkVect &ValuesPerBlock, |
1799 | 1800 | // Erase instructions generated by the failed PHI translation before |
1800 | 1801 | // trying to number them. PHI translation might insert instructions |
1801 | 1802 | // in basic blocks other than the current one, and we delete them |
1802 | | - // directly, as doInstructionDeletion only allows removing from the |
| 1803 | + // directly, as salvageAndRemoveInstruction only allows removing from the |
1803 | 1804 | // current basic block. |
1804 | 1805 | NewInsts.pop_back_val()->eraseFromParent(); |
1805 | 1806 | } |
@@ -2000,7 +2001,7 @@ bool GVNPass::processNonLocalLoad(LoadInst *Load) { |
2000 | 2001 | MD->invalidateCachedPointerInfo(V); |
2001 | 2002 | ++NumGVNLoad; |
2002 | 2003 | reportLoadElim(Load, V, ORE); |
2003 | | - doInstructionDeletion(Load); |
| 2004 | + salvageAndRemoveInstruction(Load); |
2004 | 2005 | return true; |
2005 | 2006 | } |
2006 | 2007 |
|
@@ -2068,7 +2069,7 @@ bool GVNPass::processAssumeIntrinsic(AssumeInst *IntrinsicI) { |
2068 | 2069 | } |
2069 | 2070 | } |
2070 | 2071 | if (isAssumeWithEmptyBundle(*IntrinsicI)) { |
2071 | | - doInstructionDeletion(IntrinsicI); |
| 2072 | + salvageAndRemoveInstruction(IntrinsicI); |
2072 | 2073 | return true; |
2073 | 2074 | } |
2074 | 2075 | return false; |
@@ -2179,7 +2180,7 @@ bool GVNPass::processLoad(LoadInst *L) { |
2179 | 2180 | return false; |
2180 | 2181 |
|
2181 | 2182 | if (L->use_empty()) { |
2182 | | - doInstructionDeletion(L); |
| 2183 | + salvageAndRemoveInstruction(L); |
2183 | 2184 | return true; |
2184 | 2185 | } |
2185 | 2186 |
|
@@ -2213,9 +2214,9 @@ bool GVNPass::processLoad(LoadInst *L) { |
2213 | 2214 | MSSAU->removeMemoryAccess(L); |
2214 | 2215 | ++NumGVNLoad; |
2215 | 2216 | reportLoadElim(L, AvailableValue, ORE); |
| 2217 | + salvageAndRemoveInstruction(L); |
2216 | 2218 | // Tell MDA to reexamine the reused pointer since we might have more |
2217 | 2219 | // information after forwarding it. |
2218 | | - doInstructionDeletion(L); |
2219 | 2220 | if (MD && AvailableValue->getType()->isPtrOrPtrVectorTy()) |
2220 | 2221 | MD->invalidateCachedPointerInfo(AvailableValue); |
2221 | 2222 | return true; |
@@ -2605,7 +2606,7 @@ bool GVNPass::processInstruction(Instruction *I) { |
2605 | 2606 | Changed = true; |
2606 | 2607 | } |
2607 | 2608 | if (isInstructionTriviallyDead(I, TLI)) { |
2608 | | - doInstructionDeletion(I); |
| 2609 | + salvageAndRemoveInstruction(I); |
2609 | 2610 | Changed = true; |
2610 | 2611 | } |
2611 | 2612 | if (Changed) { |
@@ -2722,7 +2723,7 @@ bool GVNPass::processInstruction(Instruction *I) { |
2722 | 2723 | patchAndReplaceAllUsesWith(I, Repl); |
2723 | 2724 | if (MD && Repl->getType()->isPtrOrPtrVectorTy()) |
2724 | 2725 | MD->invalidateCachedPointerInfo(Repl); |
2725 | | - doInstructionDeletion(I); |
| 2726 | + salvageAndRemoveInstruction(I); |
2726 | 2727 | return true; |
2727 | 2728 | } |
2728 | 2729 |
|
|
0 commit comments