[llvm] 00a10ef - [InstCombine] Regenerate test checks (NFC)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 03:58:24 PST 2023


Author: Antonio Frighetto
Date: 2023-11-30T12:56:22+01:00
New Revision: 00a10efdb12dbc3f5a0ba16f6c92cac713f0590b

URL: https://github.com/llvm/llvm-project/commit/00a10efdb12dbc3f5a0ba16f6c92cac713f0590b
DIFF: https://github.com/llvm/llvm-project/commit/00a10efdb12dbc3f5a0ba16f6c92cac713f0590b.diff

LOG: [InstCombine] Regenerate test checks (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/add3.ll
    llvm/test/Transforms/InstCombine/addnegneg.ll
    llvm/test/Transforms/InstCombine/allocsize.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/add3.ll b/llvm/test/Transforms/InstCombine/add3.ll
index 7580a1ba003c762..811173d11ff4195 100644
--- a/llvm/test/Transforms/InstCombine/add3.ll
+++ b/llvm/test/Transforms/InstCombine/add3.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt < %s -passes=instcombine -S | grep inttoptr | count 2
 
 ;; Target triple for gep raising case below.
@@ -7,15 +8,15 @@ target triple = "i686-apple-darwin8"
 ; PR1795
 define void @test2(i32 %.val24) {
 EntryBlock:
-        add i32 %.val24, -12
-        inttoptr i32 %0 to ptr
-        store i32 1, ptr %1
-        add i32 %.val24, -16
-        inttoptr i32 %2 to ptr
-        getelementptr i32, ptr %3, i32 1
-        load i32, ptr %4
-        tail call i32 @callee( i32 %5 )
-        ret void
+  add i32 %.val24, -12
+  inttoptr i32 %0 to ptr
+  store i32 1, ptr %1
+  add i32 %.val24, -16
+  inttoptr i32 %2 to ptr
+  getelementptr i32, ptr %3, i32 1
+  load i32, ptr %4
+  tail call i32 @callee( i32 %5 )
+  ret void
 }
 
 declare i32 @callee(i32)

diff  --git a/llvm/test/Transforms/InstCombine/addnegneg.ll b/llvm/test/Transforms/InstCombine/addnegneg.ll
index bfea4f328f86559..aef93fe517afbe6 100644
--- a/llvm/test/Transforms/InstCombine/addnegneg.ll
+++ b/llvm/test/Transforms/InstCombine/addnegneg.ll
@@ -1,11 +1,12 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt < %s -passes=instcombine -S | grep " sub " | count 1
 ; PR2047
 
 define i32 @l(i32 %a, i32 %b, i32 %c, i32 %d) {
 entry:
-	%b.neg = sub i32 0, %b		; <i32> [#uses=1]
-	%c.neg = sub i32 0, %c		; <i32> [#uses=1]
-	%sub4 = add i32 %c.neg, %b.neg		; <i32> [#uses=1]
-	%sub6 = add i32 %sub4, %d		; <i32> [#uses=1]
-	ret i32 %sub6
+  %b.neg = sub i32 0, %b		; <i32> [#uses=1]
+  %c.neg = sub i32 0, %c		; <i32> [#uses=1]
+  %sub4 = add i32 %c.neg, %b.neg		; <i32> [#uses=1]
+  %sub6 = add i32 %sub4, %d		; <i32> [#uses=1]
+  ret i32 %sub6
 }

diff  --git a/llvm/test/Transforms/InstCombine/allocsize.ll b/llvm/test/Transforms/InstCombine/allocsize.ll
index ea7c28c5f4ea754..031053c3953168b 100644
--- a/llvm/test/Transforms/InstCombine/allocsize.ll
+++ b/llvm/test/Transforms/InstCombine/allocsize.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
 ;
 ; Test that instcombine folds allocsize function calls properly.
@@ -8,46 +9,72 @@
 declare ptr @my_malloc(ptr, i32) allocsize(1)
 declare ptr @my_calloc(ptr, ptr, i32, i32) allocsize(2, 3)
 
-; CHECK-LABEL: define void @test_malloc
 define void @test_malloc(ptr %p, ptr %r) {
+; CHECK-LABEL: define void @test_malloc(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call dereferenceable_or_null(100) ptr @my_malloc(ptr null, i32 100)
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    store i64 100, ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_malloc(ptr null, i32 100)
   store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed
 
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
-  ; CHECK: store i64 100
   store i64 %2, ptr %r, align 8
   ret void
 }
 
-; CHECK-LABEL: define void @test_calloc
 define void @test_calloc(ptr %p, ptr %r) {
+; CHECK-LABEL: define void @test_calloc(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call dereferenceable_or_null(500) ptr @my_calloc(ptr null, ptr null, i32 100, i32 5)
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    store i64 500, ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_calloc(ptr null, ptr null, i32 100, i32 5)
   store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed
 
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
-  ; CHECK: store i64 500
   store i64 %2, ptr %r, align 8
   ret void
 }
 
 ; Failure cases with non-constant values...
-; CHECK-LABEL: define void @test_malloc_fails
 define void @test_malloc_fails(ptr %p, ptr %r, i32 %n) {
+; CHECK-LABEL: define void @test_malloc_fails(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call ptr @my_malloc(ptr null, i32 [[N]])
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    [[TMP2:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[TMP1]], i1 false, i1 false, i1 false)
+; CHECK-NEXT:    store i64 [[TMP2]], ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_malloc(ptr null, i32 %n)
   store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed
 
-  ; CHECK: @llvm.objectsize.i64.p0
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
   store i64 %2, ptr %r, align 8
   ret void
 }
 
-; CHECK-LABEL: define void @test_calloc_fails
 define void @test_calloc_fails(ptr %p, ptr %r, i32 %n) {
+; CHECK-LABEL: define void @test_calloc_fails(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]], i32 [[N:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call ptr @my_calloc(ptr null, ptr null, i32 [[N]], i32 5)
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    [[TMP2:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[TMP1]], i1 false, i1 false, i1 false)
+; CHECK-NEXT:    store i64 [[TMP2]], ptr [[R]], align 8
+; CHECK-NEXT:    [[TMP3:%.*]] = call ptr @my_calloc(ptr null, ptr null, i32 100, i32 [[N]])
+; CHECK-NEXT:    store ptr [[TMP3]], ptr [[P]], align 8
+; CHECK-NEXT:    [[TMP4:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr [[TMP3]], i1 false, i1 false, i1 false)
+; CHECK-NEXT:    store i64 [[TMP4]], ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_calloc(ptr null, ptr null, i32 %n, i32 5)
   store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed
 
-  ; CHECK: @llvm.objectsize.i64.p0
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
   store i64 %2, ptr %r, align 8
 
@@ -55,7 +82,6 @@ define void @test_calloc_fails(ptr %p, ptr %r, i32 %n) {
   %3 = call ptr @my_calloc(ptr null, ptr null, i32 100, i32 %n)
   store ptr %3, ptr %p, align 8 ; To ensure objectsize isn't killed
 
-  ; CHECK: @llvm.objectsize.i64.p0
   %4 = call i64 @llvm.objectsize.i64.p0(ptr %3, i1 false)
   store i64 %4, ptr %r, align 8
   ret void
@@ -65,13 +91,21 @@ declare ptr @my_malloc_outofline(ptr, i32) #0
 declare ptr @my_calloc_outofline(ptr, ptr, i32, i32) #1
 
 ; Verifying that out of line allocsize is parsed correctly
-; CHECK-LABEL: define void @test_outofline
 define void @test_outofline(ptr %p, ptr %r) {
+; CHECK-LABEL: define void @test_outofline(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call dereferenceable_or_null(100) ptr @my_malloc_outofline(ptr null, i32 100)
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    store i64 100, ptr [[R]], align 8
+; CHECK-NEXT:    [[TMP2:%.*]] = call dereferenceable_or_null(500) ptr @my_calloc_outofline(ptr null, ptr null, i32 100, i32 5)
+; CHECK-NEXT:    store ptr [[TMP2]], ptr [[P]], align 8
+; CHECK-NEXT:    store i64 500, ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_malloc_outofline(ptr null, i32 100)
   store ptr %1, ptr %p, align 8 ; To ensure objectsize isn't killed
 
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
-  ; CHECK: store i64 100
   store i64 %2, ptr %r, align 8
 
 
@@ -79,7 +113,6 @@ define void @test_outofline(ptr %p, ptr %r) {
   store ptr %3, ptr %p, align 8 ; To ensure objectsize isn't killed
 
   %4 = call i64 @llvm.objectsize.i64.p0(ptr %3, i1 false)
-  ; CHECK: store i64 500
   store i64 %4, ptr %r, align 8
   ret void
 }
@@ -88,14 +121,30 @@ declare ptr @my_malloc_i64(ptr, i64) #0
 declare ptr @my_tiny_calloc(ptr, ptr, i8, i8) #1
 declare ptr @my_varied_calloc(ptr, ptr, i32, i8) #1
 
-; CHECK-LABEL: define void @test_overflow
 define void @test_overflow(ptr %p, ptr %r) {
-
   ; (2**31 + 1) * 2 > 2**31. So overflow. Yay.
+; CHECK-LABEL: define void @test_overflow(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT:    [[BIG_MALLOC:%.*]] = call dereferenceable_or_null(4294967298) ptr @my_calloc(ptr null, ptr null, i32 -2147483647, i32 2)
+; CHECK-NEXT:    store ptr [[BIG_MALLOC]], ptr [[P]], align 8
+; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr [[BIG_MALLOC]], i1 false, i1 false, i1 false)
+; CHECK-NEXT:    store i32 [[TMP1]], ptr [[R]], align 4
+; CHECK-NEXT:    [[BIG_LITTLE_MALLOC:%.*]] = call dereferenceable_or_null(508) ptr @my_tiny_calloc(ptr null, ptr null, i8 127, i8 4)
+; CHECK-NEXT:    store ptr [[BIG_LITTLE_MALLOC]], ptr [[P]], align 8
+; CHECK-NEXT:    store i32 508, ptr [[R]], align 4
+; CHECK-NEXT:    [[BIG_MALLOC_I64:%.*]] = call dereferenceable_or_null(8589934592) ptr @my_malloc_i64(ptr null, i64 8589934592)
+; CHECK-NEXT:    store ptr [[BIG_MALLOC_I64]], ptr [[P]], align 8
+; CHECK-NEXT:    [[TMP2:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr [[BIG_MALLOC_I64]], i1 false, i1 false, i1 false)
+; CHECK-NEXT:    store i32 [[TMP2]], ptr [[R]], align 4
+; CHECK-NEXT:    store i64 8589934592, ptr [[R]], align 8
+; CHECK-NEXT:    [[VARIED_CALLOC:%.*]] = call dereferenceable_or_null(5000) ptr @my_varied_calloc(ptr null, ptr null, i32 1000, i8 5)
+; CHECK-NEXT:    store ptr [[VARIED_CALLOC]], ptr [[P]], align 8
+; CHECK-NEXT:    store i32 5000, ptr [[R]], align 4
+; CHECK-NEXT:    ret void
+;
   %big_malloc = call ptr @my_calloc(ptr null, ptr null, i32 2147483649, i32 2)
   store ptr %big_malloc, ptr %p, align 8
 
-  ; CHECK: @llvm.objectsize
   %1 = call i32 @llvm.objectsize.i32.p0(ptr %big_malloc, i1 false)
   store i32 %1, ptr %r, align 4
 
@@ -103,7 +152,6 @@ define void @test_overflow(ptr %p, ptr %r) {
   %big_little_malloc = call ptr @my_tiny_calloc(ptr null, ptr null, i8 127, i8 4)
   store ptr %big_little_malloc, ptr %p, align 8
 
-  ; CHECK: store i32 508
   %2 = call i32 @llvm.objectsize.i32.p0(ptr %big_little_malloc, i1 false)
   store i32 %2, ptr %r, align 4
 
@@ -112,13 +160,11 @@ define void @test_overflow(ptr %p, ptr %r) {
   %big_malloc_i64 = call ptr @my_malloc_i64(ptr null, i64 8589934592)
   store ptr %big_malloc_i64, ptr %p, align 8
 
-  ; CHECK: @llvm.objectsize
   %3 = call i32 @llvm.objectsize.i32.p0(ptr %big_malloc_i64, i1 false)
   store i32 %3, ptr %r, align 4
 
 
   %4 = call i64 @llvm.objectsize.i64.p0(ptr %big_malloc_i64, i1 false)
-  ; CHECK: store i64 8589934592
   store i64 %4, ptr %r, align 8
 
 
@@ -126,22 +172,26 @@ define void @test_overflow(ptr %p, ptr %r) {
   %varied_calloc = call ptr @my_varied_calloc(ptr null, ptr null, i32 1000, i8 5)
   store ptr %varied_calloc, ptr %p, align 8
 
-  ; CHECK: store i32 5000
   %5 = call i32 @llvm.objectsize.i32.p0(ptr %varied_calloc, i1 false)
   store i32 %5, ptr %r, align 4
 
   ret void
 }
 
-; CHECK-LABEL: define void @test_nobuiltin
 ; We had a bug where `nobuiltin` would cause `allocsize` to be ignored in
 ; @llvm.objectsize calculations.
 define void @test_nobuiltin(ptr %p, ptr %r) {
+; CHECK-LABEL: define void @test_nobuiltin(
+; CHECK-SAME: ptr [[P:%.*]], ptr [[R:%.*]]) {
+; CHECK-NEXT:    [[TMP1:%.*]] = call dereferenceable_or_null(100) ptr @my_malloc(ptr null, i32 100) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT:    store ptr [[TMP1]], ptr [[P]], align 8
+; CHECK-NEXT:    store i64 100, ptr [[R]], align 8
+; CHECK-NEXT:    ret void
+;
   %1 = call ptr @my_malloc(ptr null, i32 100) nobuiltin
   store ptr %1, ptr %p, align 8
 
   %2 = call i64 @llvm.objectsize.i64.p0(ptr %1, i1 false)
-  ; CHECK: store i64 100
   store i64 %2, ptr %r, align 8
   ret void
 }


        


More information about the llvm-commits mailing list