summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/rd-mod-wr-eflags.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2012-05-16 01:54:27 +0000
committerEvan Cheng <evan.cheng@apple.com>2012-05-16 01:54:27 +0000
commit6100366c2f543ea1bc26b3c22b7543237bd79274 (patch)
treecfe953004dc513c4a18ec35a1b55580a16b192d0 /test/CodeGen/X86/rd-mod-wr-eflags.ll
parent99534f3a0d503a09f4088b4b3dec2b6200132541 (diff)
downloadllvm-6100366c2f543ea1bc26b3c22b7543237bd79274.tar.gz
llvm-6100366c2f543ea1bc26b3c22b7543237bd79274.tar.bz2
llvm-6100366c2f543ea1bc26b3c22b7543237bd79274.tar.xz
Avoid creating a cycle when folding load / op with flag / store. PR11451474. rdar://11451474
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/rd-mod-wr-eflags.ll')
-rw-r--r--test/CodeGen/X86/rd-mod-wr-eflags.ll46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/CodeGen/X86/rd-mod-wr-eflags.ll b/test/CodeGen/X86/rd-mod-wr-eflags.ll
index faca3d7bac..8ef9b5dec0 100644
--- a/test/CodeGen/X86/rd-mod-wr-eflags.ll
+++ b/test/CodeGen/X86/rd-mod-wr-eflags.ll
@@ -177,3 +177,49 @@ if.end4:
return:
ret void
}
+
+; Deal with TokenFactor chain
+; rdar://11236106
+@foo = external global i64*, align 8
+
+define void @test3() nounwind ssp {
+entry:
+; CHECK: test3:
+; CHECK: decq 16(%rax)
+ %0 = load i64** @foo, align 8
+ %arrayidx = getelementptr inbounds i64* %0, i64 2
+ %1 = load i64* %arrayidx, align 8
+ %dec = add i64 %1, -1
+ store i64 %dec, i64* %arrayidx, align 8
+ %cmp = icmp eq i64 %dec, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ tail call void @baz() nounwind
+ br label %if.end
+
+if.end:
+ ret void
+}
+
+declare void @baz()
+
+; Avoid creating a cycle in the DAG which would trigger an assert in the
+; scheduler.
+; PR12565
+; rdar://11451474
+@x = external global i32, align 4
+@y = external global i32, align 4
+@z = external global i32, align 4
+
+define void @test4() nounwind uwtable ssp {
+entry:
+ %0 = load i32* @x, align 4
+ %1 = load i32* @y, align 4
+ %dec = add nsw i32 %1, -1
+ store i32 %dec, i32* @y, align 4
+ %tobool.i = icmp ne i32 %dec, 0
+ %cond.i = select i1 %tobool.i, i32 %0, i32 0
+ store i32 %cond.i, i32* @z, align 4
+ ret void
+}