[llvm-branch-commits] [llvm] 6612409 - [ConstraintElimination] Expand GEP decomposition tests.

Florian Hahn via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 30 12:42:52 PST 2020


Author: Florian Hahn
Date: 2020-11-30T20:33:18Z
New Revision: 66124098a88a564143a36869f495708502a35c50

URL: https://github.com/llvm/llvm-project/commit/66124098a88a564143a36869f495708502a35c50
DIFF: https://github.com/llvm/llvm-project/commit/66124098a88a564143a36869f495708502a35c50.diff

LOG: [ConstraintElimination] Expand GEP decomposition tests.

This adjusts the tests to cover more scenarios.

Added: 
    

Modified: 
    llvm/test/Transforms/ConstraintElimination/geps.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/ConstraintElimination/geps.ll b/llvm/test/Transforms/ConstraintElimination/geps.ll
index abd63b211ad8..ed013ed2c961 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps.ll
@@ -384,18 +384,22 @@ define void @test.ult.gep.shl(i32* readonly %src, i32* readnone %max, i32 %idx,
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[IDX:%.*]], 5
 ; CHECK-NEXT:    br i1 [[CMP]], label [[CHECK_MAX:%.*]], label [[TRAP]]
 ; CHECK:       check.max:
-; CHECK-NEXT:    [[IDX_SHL:%.*]] = shl nuw i32 [[IDX]], 2
-; CHECK-NEXT:    [[ADD_PTR_SHL:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL]]
-; CHECK-NEXT:    [[C_MAX_0:%.*]] = icmp ult i32* [[ADD_PTR_SHL]], [[MAX]]
+; CHECK-NEXT:    [[IDX_SHL_1:%.*]] = shl nuw i32 [[IDX]], 1
+; CHECK-NEXT:    [[ADD_PTR_SHL_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_1]]
+; CHECK-NEXT:    [[C_MAX_0:%.*]] = icmp ult i32* [[ADD_PTR_SHL_1]], [[MAX]]
 ; CHECK-NEXT:    call void @use(i1 [[C_MAX_0]])
-; CHECK-NEXT:    [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 2
-; CHECK-NEXT:    [[ADD_PTR_SHL_NOT_NUW:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_NOT_NUW]]
-; CHECK-NEXT:    [[C_MAX_1:%.*]] = icmp ult i32* [[ADD_PTR_SHL_NOT_NUW]], [[MAX]]
+; CHECK-NEXT:    [[IDX_SHL_2:%.*]] = shl nuw i32 [[IDX]], 2
+; CHECK-NEXT:    [[ADD_PTR_SHL_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_2]]
+; CHECK-NEXT:    [[C_MAX_1:%.*]] = icmp ult i32* [[ADD_PTR_SHL_2]], [[MAX]]
 ; CHECK-NEXT:    call void @use(i1 [[C_MAX_1]])
+; CHECK-NEXT:    [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 1
+; CHECK-NEXT:    [[ADD_PTR_SHL_NOT_NUW:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_NOT_NUW]]
+; CHECK-NEXT:    [[C_MAX_2:%.*]] = icmp ult i32* [[ADD_PTR_SHL_NOT_NUW]], [[MAX]]
+; CHECK-NEXT:    call void @use(i1 [[C_MAX_2]])
 ; CHECK-NEXT:    [[IDX_SHL_3:%.*]] = shl nuw i32 [[IDX]], 3
 ; CHECK-NEXT:    [[ADD_PTR_SHL_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i32 [[IDX_SHL_3]]
-; CHECK-NEXT:    [[C_MAX_2:%.*]] = icmp ult i32* [[ADD_PTR_SHL_3]], [[MAX]]
-; CHECK-NEXT:    call void @use(i1 [[C_MAX_2]])
+; CHECK-NEXT:    [[C_MAX_3:%.*]] = icmp ult i32* [[ADD_PTR_SHL_3]], [[MAX]]
+; CHECK-NEXT:    call void @use(i1 [[C_MAX_3]])
 ; CHECK-NEXT:    ret void
 ;
 check.0.min:
@@ -411,20 +415,25 @@ check.idx:                                      ; preds = %check.0.min
   br i1 %cmp, label %check.max, label %trap
 
 check.max:                                      ; preds = %check.0.min
-  %idx.shl = shl nuw i32 %idx, 2
-  %add.ptr.shl = getelementptr inbounds i32, i32* %src, i32 %idx.shl
-  %c.max.0 = icmp ult i32* %add.ptr.shl, %max
+  %idx.shl.1 = shl nuw i32 %idx, 1
+  %add.ptr.shl.1 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.1
+  %c.max.0 = icmp ult i32* %add.ptr.shl.1, %max
   call void @use(i1 %c.max.0)
 
-  %idx.shl.not.nuw = shl i32 %idx, 2
-  %add.ptr.shl.not.nuw = getelementptr inbounds i32, i32* %src, i32 %idx.shl.not.nuw
-  %c.max.1 = icmp ult i32* %add.ptr.shl.not.nuw, %max
+  %idx.shl.2 = shl nuw i32 %idx, 2
+  %add.ptr.shl.2 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.2
+  %c.max.1 = icmp ult i32* %add.ptr.shl.2, %max
   call void @use(i1 %c.max.1)
 
+  %idx.shl.not.nuw = shl i32 %idx, 1
+  %add.ptr.shl.not.nuw = getelementptr inbounds i32, i32* %src, i32 %idx.shl.not.nuw
+  %c.max.2 = icmp ult i32* %add.ptr.shl.not.nuw, %max
+  call void @use(i1 %c.max.2)
+
   %idx.shl.3 = shl nuw i32 %idx, 3
   %add.ptr.shl.3 = getelementptr inbounds i32, i32* %src, i32 %idx.shl.3
-  %c.max.2 = icmp ult i32* %add.ptr.shl.3, %max
-  call void @use(i1 %c.max.2)
+  %c.max.3 = icmp ult i32* %add.ptr.shl.3, %max
+  call void @use(i1 %c.max.3)
 
   ret void
 }
@@ -442,17 +451,17 @@ define void @test.ult.gep.shl.zext(i32* readonly %src, i32* readnone %max, i32 %
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[IDX:%.*]], 5
 ; CHECK-NEXT:    br i1 [[CMP]], label [[CHECK_MAX:%.*]], label [[TRAP]]
 ; CHECK:       check.max:
-; CHECK-NEXT:    [[IDX_SHL:%.*]] = shl nuw i32 [[IDX]], 2
+; CHECK-NEXT:    [[IDX_SHL:%.*]] = shl nuw i32 [[IDX]], 1
 ; CHECK-NEXT:    [[EXT_1:%.*]] = zext i32 [[IDX_SHL]] to i64
 ; CHECK-NEXT:    [[ADD_PTR_SHL:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[EXT_1]]
 ; CHECK-NEXT:    [[C_MAX_0:%.*]] = icmp ult i32* [[ADD_PTR_SHL]], [[MAX]]
 ; CHECK-NEXT:    call void @use(i1 [[C_MAX_0]])
-; CHECK-NEXT:    [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 2
+; CHECK-NEXT:    [[IDX_SHL_NOT_NUW:%.*]] = shl i32 [[IDX]], 1
 ; CHECK-NEXT:    [[EXT_2:%.*]] = zext i32 [[IDX_SHL_NOT_NUW]] to i64
 ; CHECK-NEXT:    [[ADD_PTR_SHL_NOT_NUW:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[EXT_2]]
 ; CHECK-NEXT:    [[C_MAX_1:%.*]] = icmp ult i32* [[ADD_PTR_SHL_NOT_NUW]], [[MAX]]
 ; CHECK-NEXT:    call void @use(i1 [[C_MAX_1]])
-; CHECK-NEXT:    [[IDX_SHL_3:%.*]] = shl nuw i32 [[IDX]], 3
+; CHECK-NEXT:    [[IDX_SHL_3:%.*]] = shl nuw i32 [[IDX]], 2
 ; CHECK-NEXT:    [[EXT_3:%.*]] = zext i32 [[IDX_SHL_3]] to i64
 ; CHECK-NEXT:    [[ADD_PTR_SHL_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[EXT_3]]
 ; CHECK-NEXT:    [[C_MAX_2:%.*]] = icmp ult i32* [[ADD_PTR_SHL_3]], [[MAX]]
@@ -472,19 +481,19 @@ check.idx:                                      ; preds = %check.0.min
   br i1 %cmp, label %check.max, label %trap
 
 check.max:                                      ; preds = %check.0.min
-  %idx.shl = shl nuw i32 %idx, 2
+  %idx.shl = shl nuw i32 %idx, 1
   %ext.1 = zext i32 %idx.shl to i64
   %add.ptr.shl = getelementptr inbounds i32, i32* %src, i64 %ext.1
   %c.max.0 = icmp ult i32* %add.ptr.shl, %max
   call void @use(i1 %c.max.0)
 
-  %idx.shl.not.nuw = shl i32 %idx, 2
+  %idx.shl.not.nuw = shl i32 %idx, 1
   %ext.2 = zext i32 %idx.shl.not.nuw to i64
   %add.ptr.shl.not.nuw = getelementptr inbounds i32, i32* %src, i64 %ext.2
   %c.max.1 = icmp ult i32* %add.ptr.shl.not.nuw, %max
   call void @use(i1 %c.max.1)
 
-  %idx.shl.3 = shl nuw i32 %idx, 3
+  %idx.shl.3 = shl nuw i32 %idx, 2
   %ext.3 = zext i32 %idx.shl.3 to i64
   %add.ptr.shl.3 = getelementptr inbounds i32, i32* %src, i64 %ext.3
   %c.max.2 = icmp ult i32* %add.ptr.shl.3, %max


        


More information about the llvm-branch-commits mailing list