diff options
Diffstat (limited to 'llvm/lib/CodeGen/AtomicExpandPass.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AtomicExpandPass.cpp | 10 |
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); } |