[llvm] 2aed3cd - [test] Reduced test for second distinct issue triggering revert of 9153515

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 12:13:34 PDT 2022


Author: Philip Reames
Date: 2022-07-15T12:13:27-07:00
New Revision: 2aed3cdb5eeaeb0154a4cbc2c582997a98136b0f

URL: https://github.com/llvm/llvm-project/commit/2aed3cdb5eeaeb0154a4cbc2c582997a98136b0f
DIFF: https://github.com/llvm/llvm-project/commit/2aed3cdb5eeaeb0154a4cbc2c582997a98136b0f.diff

LOG: [test] Reduced test for second distinct issue triggering revert of 9153515

Added: 
    

Modified: 
    llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll b/llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll
index 8835c0c44d9d..f0aa0f2e93f4 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll
@@ -351,4 +351,36 @@ exit:
   ret void
 }
 
+; Loop invariant does not neccessarily mean dominating the loop.  Forming
+; an ICmpZero from this example would be illegal even though the operands
+; to the compare are loop invariant.
+define void @loop_invariant_definition(i64 %arg) {
+; CHECK-LABEL: @loop_invariant_definition(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br label [[T1:%.*]]
+; CHECK:       t1:
+; CHECK-NEXT:    [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[T1]] ], [ -1, [[ENTRY:%.*]] ]
+; CHECK-NEXT:    [[LSR_IV_NEXT]] = add nsw i64 [[LSR_IV]], 1
+; CHECK-NEXT:    br i1 true, label [[T4:%.*]], label [[T1]]
+; CHECK:       t4:
+; CHECK-NEXT:    [[T5:%.*]] = trunc i64 [[LSR_IV_NEXT]] to i32
+; CHECK-NEXT:    [[T6:%.*]] = add i32 [[T5]], 1
+; CHECK-NEXT:    [[T7:%.*]] = icmp eq i32 [[T5]], [[T6]]
+; CHECK-NEXT:    ret void
+;
+entry:
+  br label %t1
+
+t1:                                                ; preds = %1, %0
+  %t2 = phi i64 [ %t3, %t1 ], [ 0, %entry ]
+  %t3 = add nuw i64 %t2, 1
+  br i1 true, label %t4, label %t1
+
+t4:                                                ; preds = %1
+  %t5 = trunc i64 %t2 to i32
+  %t6 = add i32 %t5, 1
+  %t7 = icmp eq i32 %t5, %t6
+  ret void
+}
+
 declare i64 @llvm.vscale.i64()


        


More information about the llvm-commits mailing list