summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2018-11-02 18:25:41 +0000
committerJordan Rupprecht <rupprecht@google.com>2018-11-02 18:25:41 +0000
commit80e7e86c2999f90be7730036479c5418c059d336 (patch)
tree4b0e344bc0b4ffa5c45e056c2bbf650fab2e0ce5 /llvm/test
parent5f7cb79e94e6ad4f34efe1f074956b7aaa05eaef (diff)
downloadbcm5719-llvm-80e7e86c2999f90be7730036479c5418c059d336.tar.gz
bcm5719-llvm-80e7e86c2999f90be7730036479c5418c059d336.zip
[DebugInfo][InstMerge] Fix -debugify for phi node created by -mldst-motion
Summary: -mldst-motion creates a new phi node without any debug info. Use the merged debug location from the incoming stores to fix this. Fixes PR38177. The test case here is (somewhat) simplified from: ``` struct S { int foo; void fn(int bar); }; void S::fn(int bar) { if (bar) foo = 1; else foo = 0; } ``` Reviewers: dblaikie, gbedwell, aprantl, vsk Reviewed By: vsk Subscribers: vsk, JDevlieghere, llvm-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D54019 llvm-svn: 346027
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstMerge/st_sink_check_debug.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstMerge/st_sink_check_debug.ll b/llvm/test/Transforms/InstMerge/st_sink_check_debug.ll
new file mode 100644
index 00000000000..94d46a58f4c
--- /dev/null
+++ b/llvm/test/Transforms/InstMerge/st_sink_check_debug.ll
@@ -0,0 +1,32 @@
+; RUN: opt < %s -S -debugify -mldst-motion -o - | FileCheck %s
+
+%struct.S = type { i32 }
+
+define dso_local void @foo(%struct.S* %this, i32 %bar) {
+entry:
+ %this.addr = alloca %struct.S*, align 8
+ %bar.addr = alloca i32, align 4
+ store %struct.S* %this, %struct.S** %this.addr, align 8
+ store i32 %bar, i32* %bar.addr, align 4
+ %this1 = load %struct.S*, %struct.S** %this.addr, align 8
+ %0 = load i32, i32* %bar.addr, align 4
+ %tobool = icmp ne i32 %0, 0
+ br i1 %tobool, label %if.then, label %if.else
+
+if.then: ; preds = %entry
+ %foo = getelementptr inbounds %struct.S, %struct.S* %this1, i32 0, i32 0
+ store i32 1, i32* %foo, align 4
+ br label %if.end
+
+if.else: ; preds = %entry
+ %foo2 = getelementptr inbounds %struct.S, %struct.S* %this1, i32 0, i32 0
+ store i32 0, i32* %foo2, align 4
+ br label %if.end
+
+if.end: ; preds = %if.else, %if.then
+ ret void
+}
+
+; CHECK: @foo
+; CHECK: if.end: ; preds = %if.else, %if.then
+; CHECK-NEXT: %.sink = phi {{.*}} !dbg
OpenPOWER on IntegriCloud