[llvm] 4af2730 - [LoopUnroll] Add store to unreachable latch test (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 13:49:49 PDT 2021


Author: Nikita Popov
Date: 2021-05-28T22:49:23+02:00
New Revision: 4af2730ac3e9e712266bcdb754e605d7d9c190fd

URL: https://github.com/llvm/llvm-project/commit/4af2730ac3e9e712266bcdb754e605d7d9c190fd
DIFF: https://github.com/llvm/llvm-project/commit/4af2730ac3e9e712266bcdb754e605d7d9c190fd.diff

LOG: [LoopUnroll] Add store to unreachable latch test (NFC)

This is to show that we currently only convert the terminator to
unreachable, but don't clean up instructions before it (unless
trivial DCE removes them).

Also clean up excessive whitespace in this test.

Added: 
    

Modified: 
    llvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll b/llvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll
index 4970a9080940f..7d56166d0cd56 100644
--- a/llvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll
+++ b/llvm/test/Transforms/LoopUnroll/unroll-unconditional-latch.ll
@@ -3,7 +3,7 @@
 
 %struct.spam = type { double, double, double, double, double, double, double }
 
-define void @test2(i32* %arg)  {
+define void @test2(i32* %arg, i64* %out)  {
 ; CHECK-LABEL: @test2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[FOR_HEADER:%.*]]
@@ -11,29 +11,27 @@ define void @test2(i32* %arg)  {
 ; CHECK-NEXT:    store i32 0, i32* [[ARG:%.*]], align 4
 ; CHECK-NEXT:    br label [[FOR_LATCH:%.*]]
 ; CHECK:       for.latch:
+; CHECK-NEXT:    store volatile i64 0, i64* [[OUT:%.*]], align 4
 ; CHECK-NEXT:    [[PTR_1:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i64 1
 ; CHECK-NEXT:    store i32 0, i32* [[PTR_1]], align 4
 ; CHECK-NEXT:    br label [[FOR_LATCH_1:%.*]]
 ; CHECK:       if.end.loopexit:
 ; CHECK-NEXT:    ret void
 ; CHECK:       for.latch.1:
+; CHECK-NEXT:    store volatile i64 1, i64* [[OUT]], align 4
 ; CHECK-NEXT:    [[PTR_2:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i64 2
 ; CHECK-NEXT:    store i32 0, i32* [[PTR_2]], align 4
 ; CHECK-NEXT:    br label [[FOR_LATCH_2:%.*]]
 ; CHECK:       for.latch.2:
+; CHECK-NEXT:    store volatile i64 2, i64* [[OUT]], align 4
 ; CHECK-NEXT:    [[PTR_3:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i64 3
 ; CHECK-NEXT:    store i32 0, i32* [[PTR_3]], align 4
 ; CHECK-NEXT:    br i1 true, label [[IF_END_LOOPEXIT:%.*]], label [[FOR_LATCH_3:%.*]]
 ; CHECK:       for.latch.3:
+; CHECK-NEXT:    store volatile i64 3, i64* [[OUT]], align 4
 ; CHECK-NEXT:    unreachable
 ;
 
-
-
-
-
-
-
 entry:
   br label %for.header
 
@@ -46,6 +44,7 @@ for.header:                              ; preds = %for.latch, %entry
   br i1 %exitcond802, label %if.end.loopexit, label %for.latch
 
 for.latch: ; preds = %for.header
+  store volatile i64 %indvars.iv800, i64* %out
   br label %for.header
 
 if.end.loopexit:                                  ; preds = %for.header
@@ -71,10 +70,6 @@ define double @test_with_lcssa(double %arg1, double* %arg2) {
 ; CHECK-NEXT:    unreachable
 ;
 
-
-
-
-
 entry:
   br label %loop.header
 
@@ -143,16 +138,6 @@ define void @test_with_nested_loop(i32* %arg)  {
 ; CHECK-NEXT:    unreachable
 ;
 
-
-
-
-
-
-
-
-
-
-
 entry:
   br label %outer.header
 
@@ -201,9 +186,6 @@ define void @test_with_nested_loop_unroll_inner(i32* %arg)  {
 ; CHECK-NEXT:    ret void
 ;
 
-
-
-
 entry:
   br label %outer.header
 
@@ -252,10 +234,6 @@ define void @test_switchinst_in_header() {
 ; CHECK-NEXT:    ret void
 ;
 
-
-
-
-
 entry:
   br label %while.header
 


        


More information about the llvm-commits mailing list