summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 03ef8985210..1250d025fbc 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -3586,9 +3586,8 @@ Value *TypePromotionHelper::promoteOperandForOther(
// Create the truncate now.
Value *Trunc = TPT.createTrunc(Ext, ExtOpnd->getType());
if (Instruction *ITrunc = dyn_cast<Instruction>(Trunc)) {
- ITrunc->removeFromParent();
// Insert it just after the definition.
- ITrunc->insertAfter(ExtOpnd);
+ ITrunc->moveAfter(ExtOpnd);
if (Truncs)
Truncs->push_back(ITrunc);
}
@@ -4943,8 +4942,7 @@ bool CodeGenPrepare::optimizeExt(Instruction *&Inst) {
assert(LI && ExtFedByLoad && "Expect a valid load and extension");
TPT.commit();
// Move the extend into the same block as the load
- ExtFedByLoad->removeFromParent();
- ExtFedByLoad->insertAfter(LI);
+ ExtFedByLoad->moveAfter(LI);
// CGP does not check if the zext would be speculatively executed when moved
// to the same basic block as the load. Preserving its original location
// would pessimize the debugging experience, as well as negatively impact
@@ -5936,8 +5934,7 @@ void VectorPromoteHelper::promoteImpl(Instruction *ToBePromoted) {
"this?");
ToBePromoted->setOperand(U.getOperandNo(), NewVal);
}
- Transition->removeFromParent();
- Transition->insertAfter(ToBePromoted);
+ Transition->moveAfter(ToBePromoted);
Transition->setOperand(getTransitionOriginalValueIdx(), ToBePromoted);
}
OpenPOWER on IntegriCloud