diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-08-29 14:07:48 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-08-29 14:07:48 +0000 |
commit | 674d2c23ea3519a8b482f98eb56a59505ea694b9 (patch) | |
tree | 779cae0c9948ba9021cbebe2cd6a93dda4240f9d /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 86873030ae67d05fadfb228c33254bae59c905a1 (diff) | |
download | bcm5719-llvm-674d2c23ea3519a8b482f98eb56a59505ea694b9.tar.gz bcm5719-llvm-674d2c23ea3519a8b482f98eb56a59505ea694b9.zip |
[Instruction] add moveAfter() convenience function; NFCI
As suggested in D37121, here's a wrapper for removeFromParent() + insertAfter(),
but implemented using moveBefore() for symmetry/efficiency.
Differential Revision: https://reviews.llvm.org/D37239
llvm-svn: 312001
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 9 |
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); } |