From 674d2c23ea3519a8b482f98eb56a59505ea694b9 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 29 Aug 2017 14:07:48 +0000 Subject: [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 --- llvm/lib/CodeGen/AtomicExpandPass.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'llvm/lib/CodeGen/AtomicExpandPass.cpp') 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); } -- cgit v1.2.3