[llvm] c876761 - [IndVars] Add test for #102597 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 06:04:33 PDT 2024
Author: Nikita Popov
Date: 2024-08-12T15:04:23+02:00
New Revision: c876761f7ed8de0d30b65b5618bc9dbb8526bb68
URL: https://github.com/llvm/llvm-project/commit/c876761f7ed8de0d30b65b5618bc9dbb8526bb68
DIFF: https://github.com/llvm/llvm-project/commit/c876761f7ed8de0d30b65b5618bc9dbb8526bb68.diff
LOG: [IndVars] Add test for #102597 (NFC)
Added:
llvm/test/Transforms/IndVarSimplify/pr102597.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/IndVarSimplify/pr102597.ll b/llvm/test/Transforms/IndVarSimplify/pr102597.ll
new file mode 100644
index 00000000000000..2bb00da0aaf112
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr102597.ll
@@ -0,0 +1,43 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=indvars < %s | FileCheck %s
+
+; FIXME: This is a miscompile.
+define void @test() {
+; CHECK-LABEL: define void @test() {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[LOOP:.*]]
+; CHECK: [[LOOP]]:
+; CHECK-NEXT: [[IV:%.*]] = phi i128 [ 3, %[[ENTRY]] ], [ [[IV_DEC:%.*]], %[[LOOP_LATCH:.*]] ]
+; CHECK-NEXT: br i1 true, label %[[LOOP_LATCH]], label %[[IF:.*]]
+; CHECK: [[IF]]:
+; CHECK-NEXT: call void @foo()
+; CHECK-NEXT: br label %[[LOOP_LATCH]]
+; CHECK: [[LOOP_LATCH]]:
+; CHECK-NEXT: [[IV_DEC]] = add nsw i128 [[IV]], -1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i128 [[IV]], 0
+; CHECK-NEXT: br i1 [[CMP]], label %[[LOOP]], label %[[EXIT:.*]]
+; CHECK: [[EXIT]]:
+; CHECK-NEXT: ret void
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i128 [ 3, %entry ], [ %iv.dec, %loop.latch ]
+ %tobool = icmp ne i128 %iv, 0
+ br i1 %tobool, label %loop.latch, label %if
+
+if:
+ call void @foo()
+ br label %loop.latch
+
+loop.latch:
+ %iv.dec = add nsw i128 %iv, -1
+ %cmp = icmp sgt i128 %iv, 0
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}
+
+declare void @foo()
More information about the llvm-commits
mailing list