summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AtomicExpandPass.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-08-29 14:07:48 +0000
committerSanjay Patel <spatel@rotateright.com>2017-08-29 14:07:48 +0000
commit674d2c23ea3519a8b482f98eb56a59505ea694b9 (patch)
tree779cae0c9948ba9021cbebe2cd6a93dda4240f9d /llvm/lib/CodeGen/AtomicExpandPass.cpp
parent86873030ae67d05fadfb228c33254bae59c905a1 (diff)
downloadbcm5719-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/AtomicExpandPass.cpp')
-rw-r--r--llvm/lib/CodeGen/AtomicExpandPass.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index aa9c8e94d08..9d1f94a8a43 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -320,16 +320,10 @@ bool AtomicExpand::bracketInstWithFences(Instruction *I, AtomicOrdering Order) {
auto LeadingFence = TLI->emitLeadingFence(Builder, I, Order);
auto TrailingFence = TLI->emitTrailingFence(Builder, I, Order);
- // The trailing fence is emitted before the instruction instead of after
- // because there is no easy way of setting Builder insertion point after
- // an instruction. So we must erase it from the BB, and insert it back
- // in the right place.
// We have a guard here because not every atomic operation generates a
// trailing fence.
- if (TrailingFence) {
- TrailingFence->removeFromParent();
- TrailingFence->insertAfter(I);
- }
+ if (TrailingFence)
+ TrailingFence->moveAfter(I);
return (LeadingFence || TrailingFence);
}
OpenPOWER on IntegriCloud