summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2017-06-09 12:57:35 +0000
committerNirav Dave <niravd@google.com>2017-06-09 12:57:35 +0000
commit43a4d8122f4210fb0603ccc08346bcb95cacf938 (patch)
treeaf4756a779e33ad8e117337a02254ef24b5e374f /llvm/test/CodeGen/X86
parent1840901a2ff8493ca60579298be97eda8fadbcec (diff)
downloadbcm5719-llvm-43a4d8122f4210fb0603ccc08346bcb95cacf938.tar.gz
bcm5719-llvm-43a4d8122f4210fb0603ccc08346bcb95cacf938.zip
Prevent RemoveDeadNodes from deleted already deleted node.
This prevents against assertion errors like PR32659 which occur from a replacement deleting a node after it's been added to the list argument of RemoveDeadNodes. The specific failure from PR32659 does not currently happen, but it is still potentially possible. The underlying cause is that the callers of the change dfunction builds up a list of nodes to delete after having moved their uses and it possible that a move of a later node will cause a previously deleted nodes to be deleted. Reviewers: bkramer, spatel, davide Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33731 llvm-svn: 305070
Diffstat (limited to 'llvm/test/CodeGen/X86')
-rw-r--r--llvm/test/CodeGen/X86/pr32659.ll83
1 files changed, 83 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/pr32659.ll b/llvm/test/CodeGen/X86/pr32659.ll
new file mode 100644
index 00000000000..aafae9c4f6c
--- /dev/null
+++ b/llvm/test/CodeGen/X86/pr32659.ll
@@ -0,0 +1,83 @@
+; RUN: llc -o - %s | FileCheck %s
+target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
+target triple = "i386-unknown-linux-gnu"
+
+@a = external global i32, align 4
+@d = external global i32*, align 4
+@k = external global i32**, align 4
+@j = external global i32***, align 4
+@h = external global i32, align 4
+@c = external global i32, align 4
+@i = external global i32, align 4
+@b = external global i32, align 4
+@f = external global i64, align 8
+@e = external global i64, align 8
+@g = external global i32, align 4
+
+; Function Attrs: norecurse nounwind optsize readnone
+declare i32 @fn1(i32 returned) #0
+
+
+; CHECK-LABEL: fn2
+; CHECK: calll putchar
+; CHECK: addl $1,
+; CHECK: adcl $0,
+; Function Attrs: nounwind optsize
+define void @fn2() #1 {
+entry:
+ %putchar = tail call i32 @putchar(i32 48)
+ %0 = load volatile i32, i32* @h, align 4
+ %1 = load i32, i32* @c, align 4, !tbaa !2
+ %2 = load i32***, i32**** @j, align 4
+ %3 = load i32**, i32*** %2, align 4
+ %4 = load i32*, i32** %3, align 4
+ %5 = load i32, i32* %4, align 4
+ %cmp = icmp sgt i32 %1, %5
+ %conv = zext i1 %cmp to i32
+ %6 = load i32, i32* @i, align 4
+ %cmp1 = icmp sgt i32 %6, %conv
+ %conv2 = zext i1 %cmp1 to i32
+ store i32 %conv2, i32* @b, align 4
+ %cmp3 = icmp sgt i32 %0, %conv2
+ %conv4 = zext i1 %cmp3 to i32
+ %7 = load i32, i32* @a, align 4
+ %or = xor i32 %7, %conv4
+ store i32 %or, i32* @a, align 4
+ %8 = load i32*, i32** @d, align 4
+ %9 = load i32, i32* %8, align 4
+ %conv6 = sext i32 %9 to i64
+ %10 = load i64, i64* @e, align 8
+ %and = and i64 %10, %conv6
+ store i64 %and, i64* @e, align 8
+ %11 = load i32, i32* @g, align 4
+ %dec = add nsw i32 %11, -1
+ store i32 %dec, i32* @g, align 4
+ %12 = load i64, i64* @f, align 8
+ %inc = add nsw i64 %12, 1
+ store i64 %inc, i64* @f, align 8
+ ret void
+}
+
+; Function Attrs: nounwind optsize
+declare i32 @main() #1
+
+; Function Attrs: nounwind
+declare i32 @putchar(i32) #2
+
+attributes #0 = { optsize readnone }
+attributes #1 = { optsize }
+attributes #2 = { nounwind }
+
+!llvm.module.flags = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 1, !"NumRegisterParameters", i32 0}
+!1 = !{!"clang version 5.0.0 (trunk 300074) (llvm/trunk 300078)"}
+!2 = !{!3, !3, i64 0}
+!3 = !{!"int", !4, i64 0}
+!4 = !{!"omnipotent char", !5, i64 0}
+!5 = !{!"Simple C/C++ TBAA"}
+!6 = !{!7, !7, i64 0}
+!7 = !{!"any pointer", !4, i64 0}
+!8 = !{!9, !9, i64 0}
+!9 = !{!"long long", !4, i64 0}
OpenPOWER on IntegriCloud