From 28f747a6081cf2f6104443872d6ffe4673665718 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 19 Jul 2010 22:48:56 +0000 Subject: [PATCH] After a custom inserter, in a block which has constant instructions, update the current basic block in addition to the current insert position, so that they remain consistent. This fixes rdar://8204072. llvm-svn: 108765 --- lib/CodeGen/SelectionDAG/FastISel.cpp | 1 + test/CodeGen/X86/fast-isel-atomic.ll | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/CodeGen/X86/fast-isel-atomic.ll diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index cff7ace536a..1fb20f1dc06 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -276,6 +276,7 @@ std::pair FastISel::getRegForGEPIndex(const Value *Idx) { void FastISel::recomputeInsertPt() { if (getLastLocalValue()) { FuncInfo.InsertPt = getLastLocalValue(); + FuncInfo.MBB = FuncInfo.InsertPt->getParent(); ++FuncInfo.InsertPt; } else FuncInfo.InsertPt = FuncInfo.MBB->getFirstNonPHI(); diff --git a/test/CodeGen/X86/fast-isel-atomic.ll b/test/CodeGen/X86/fast-isel-atomic.ll new file mode 100644 index 00000000000..f8eee9caa6a --- /dev/null +++ b/test/CodeGen/X86/fast-isel-atomic.ll @@ -0,0 +1,16 @@ +; RUN: llc < %s -O0 -march=x86-64 +; rdar://8204072 + +@sc = external global i8 +@uc = external global i8 + +declare i8 @llvm.atomic.load.and.i8.p0i8(i8* nocapture, i8) nounwind + +define void @test_fetch_and_op() nounwind { +entry: + %tmp40 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @sc, i8 11) ; [#uses=1] + store i8 %tmp40, i8* @sc + %tmp41 = call i8 @llvm.atomic.load.and.i8.p0i8(i8* @uc, i8 11) ; [#uses=1] + store i8 %tmp41, i8* @uc + ret void +}