aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/LICM/sink_multiple.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/LICM/sink_multiple.ll')
-rw-r--r--test/Transforms/LICM/sink_multiple.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/LICM/sink_multiple.ll b/test/Transforms/LICM/sink_multiple.ll
new file mode 100644
index 0000000..49b35b6
--- /dev/null
+++ b/test/Transforms/LICM/sink_multiple.ll
@@ -0,0 +1,20 @@
+; The loop sinker was running from the bottom of the loop to the top, causing
+; it to miss opportunities to sink instructions that depended on sinking other
+; instructions from the loop. Instead they got hoisted, which is better than
+; leaving them in the loop, but increases register pressure pointlessly.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | \
+; RUN: %prcontext getelementptr 1 | grep Out:
+
+%Ty = type { int, int }
+%X = external global %Ty
+
+int %test() {
+ br label %Loop
+Loop:
+ %dead = getelementptr %Ty* %X, long 0, uint 0
+ %sunk2 = load int* %dead
+ br bool false, label %Loop, label %Out
+Out:
+ ret int %sunk2
+}