[llvm] f5f7e4e - [LICM] Add test for PR57780 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 20 04:07:39 PDT 2022
Author: Nikita Popov
Date: 2022-09-20T13:07:11+02:00
New Revision: f5f7e4e6f4b0ad0c8a5f051b50dcd097dfb73e51
URL: https://github.com/llvm/llvm-project/commit/f5f7e4e6f4b0ad0c8a5f051b50dcd097dfb73e51
DIFF: https://github.com/llvm/llvm-project/commit/f5f7e4e6f4b0ad0c8a5f051b50dcd097dfb73e51.diff
LOG: [LICM] Add test for PR57780 (NFC)
Added:
llvm/test/Transforms/LICM/pr57780.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LICM/pr57780.ll b/llvm/test/Transforms/LICM/pr57780.ll
new file mode 100644
index 0000000000000..89f48edce4d0b
--- /dev/null
+++ b/llvm/test/Transforms/LICM/pr57780.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -licm < %s | FileCheck %s
+
+ at c = global i16 0, align 2
+
+; FIXME: The store should not be hoisted.
+define void @test() {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store i16 5, ptr @c, align 2
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[V:%.*]] = phi i32 [ 10, [[ENTRY:%.*]] ], [ 0, [[LOOP_LATCH:%.*]] ]
+; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[V]], 0
+; CHECK-NEXT: br i1 [[C]], label [[LOOP_EXIT:%.*]], label [[LOOP_CONT:%.*]]
+; CHECK: loop.cont:
+; CHECK-NEXT: br i1 false, label [[LOOP_IRREDUCIBLE:%.*]], label [[LOOP_LATCH]]
+; CHECK: loop.irreducible:
+; CHECK-NEXT: br label [[LOOP_LATCH]]
+; CHECK: loop.latch:
+; CHECK-NEXT: br i1 false, label [[LOOP_IRREDUCIBLE]], label [[LOOP]]
+; CHECK: loop.exit:
+; CHECK-NEXT: ret void
+;
+entry:
+ br label %loop
+
+loop: ; preds = %loop.latch, %entry
+ %v = phi i32 [ 10, %entry ], [ 0, %loop.latch ]
+ %c = icmp eq i32 %v, 0
+ br i1 %c, label %loop.exit, label %loop.cont
+
+loop.cont: ; preds = %loop
+ br i1 false, label %loop.irreducible, label %loop.latch
+
+loop.irreducible: ; preds = %loop.latch, %loop.cont
+ store i16 5, ptr @c, align 2
+ br label %loop.latch
+
+loop.latch: ; preds = %loop.irreducible, %loop.cont
+ br i1 false, label %loop.irreducible, label %loop
+
+loop.exit: ; preds = %loop
+ ret void
+}
More information about the llvm-commits
mailing list