[llvm] 42d9742 - [InstCombine] Regenerate test checks (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 07:24:57 PDT 2023
Author: Nikita Popov
Date: 2023-05-23T16:24:41+02:00
New Revision: 42d9742752d4da5db2863c1ec11d6a61fdb85109
URL: https://github.com/llvm/llvm-project/commit/42d9742752d4da5db2863c1ec11d6a61fdb85109
DIFF: https://github.com/llvm/llvm-project/commit/42d9742752d4da5db2863c1ec11d6a61fdb85109.diff
LOG: [InstCombine] Regenerate test checks (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll
index 763645088bde..2e19260b2ced 100644
--- a/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll
+++ b/llvm/test/Transforms/InstCombine/builtin-dynamic-object-size.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128-p7:32:32"
@@ -5,6 +6,13 @@ target triple = "x86_64-apple-macosx10.14.0"
; Function Attrs: nounwind ssp uwtable
define i64 @weird_identity_but_ok(i64 %sz) {
+; CHECK-LABEL: define i64 @weird_identity_but_ok
+; CHECK-SAME: (i64 [[SZ:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ne i64 [[SZ]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
+; CHECK-NEXT: ret i64 [[SZ]]
+;
entry:
%call = tail call ptr @malloc(i64 %sz)
%calc_size = tail call i64 @llvm.objectsize.i64.p0(ptr %call, i1 false, i1 true, i1 true)
@@ -12,12 +20,19 @@ entry:
ret i64 %calc_size
}
-; CHECK: define i64 @weird_identity_but_ok(i64 %sz)
-; CHECK-NEXT: entry:
-; CHECK: ret i64 %sz
-; CHECK-NEXT: }
-
define i64 @phis_are_neat(i1 %which) {
+; CHECK-LABEL: define i64 @phis_are_neat
+; CHECK-SAME: (i1 [[WHICH:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[WHICH]], label [[FIRST_LABEL:%.*]], label [[SECOND_LABEL:%.*]]
+; CHECK: first_label:
+; CHECK-NEXT: br label [[JOIN_LABEL:%.*]]
+; CHECK: second_label:
+; CHECK-NEXT: br label [[JOIN_LABEL]]
+; CHECK: join_label:
+; CHECK-NEXT: [[TMP0:%.*]] = phi i64 [ 10, [[FIRST_LABEL]] ], [ 30, [[SECOND_LABEL]] ]
+; CHECK-NEXT: ret i64 [[TMP0]]
+;
entry:
br i1 %which, label %first_label, label %second_label
@@ -35,10 +50,13 @@ join_label:
ret i64 %calc_size
}
-; CHECK: %0 = phi i64 [ 10, %first_label ], [ 30, %second_label ]
-; CHECK-NEXT: ret i64 %0
-
define i64 @internal_pointer(i64 %sz) {
+; CHECK-LABEL: define i64 @internal_pointer
+; CHECK-SAME: (i64 [[SZ:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = call i64 @llvm.usub.sat.i64(i64 [[SZ]], i64 2)
+; CHECK-NEXT: ret i64 [[TMP0]]
+;
entry:
%ptr = call ptr @malloc(i64 %sz)
%ptr2 = getelementptr inbounds i8, ptr %ptr, i32 2
@@ -46,34 +64,53 @@ entry:
ret i64 %calc_size
}
-; CHECK: define i64 @internal_pointer(i64 %sz)
-; CHECK-NEXT: entry:
-; CHECK-NEXT: %0 = call i64 @llvm.usub.sat.i64(i64 %sz, i64 2)
-; CHECK-NEXT: ret i64 %0
-; CHECK-NEXT: }
-
define i64 @uses_nullptr_no_fold() {
+; CHECK-LABEL: define i64 @uses_nullptr_no_fold() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[RES:%.*]] = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 true, i1 true)
+; CHECK-NEXT: ret i64 [[RES]]
+;
entry:
%res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 true, i1 true)
ret i64 %res
}
-; CHECK: %res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 true, i1 true)
-
define i64 @uses_nullptr_fold() {
+; CHECK-LABEL: define i64 @uses_nullptr_fold() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret i64 0
+;
entry:
; NOTE: the third parameter to this call is false, unlike above.
%res = call i64 @llvm.objectsize.i64.p0(ptr null, i1 false, i1 false, i1 true)
ret i64 %res
}
-; CHECK: ret i64 0
-
@d = common global i8 0, align 1
@c = common global i32 0, align 4
; Function Attrs: nounwind
define void @f() {
+; CHECK-LABEL: define void @f() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[DOTPR:%.*]] = load i32, ptr @c, align 4
+; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[DOTPR]], 0
+; CHECK-NEXT: br i1 [[TOBOOL4]], label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
+; CHECK: for.body:
+; CHECK-NEXT: [[DP_05:%.*]] = phi ptr [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ @d, [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.objectsize.i64.p0(ptr [[DP_05]], i1 false, i1 true, i1 true)
+; CHECK-NEXT: [[CONV:%.*]] = trunc i64 [[TMP0]] to i32
+; CHECK-NEXT: tail call void @bury(i32 [[CONV]])
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @c, align 4
+; CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP1]] to i64
+; CHECK-NEXT: [[ADD_PTR]] = getelementptr inbounds i8, ptr [[DP_05]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[ADD:%.*]] = shl nsw i32 [[TMP1]], 1
+; CHECK-NEXT: store i32 [[ADD]], ptr @c, align 4
+; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TOBOOL]], label [[FOR_END]], label [[FOR_BODY]]
+; CHECK: for.end:
+; CHECK-NEXT: ret void
+;
entry:
%.pr = load i32, ptr @c, align 4
%tobool4 = icmp eq i32 %.pr, 0
@@ -98,10 +135,22 @@ for.end: ; preds = %for.body, %entry
ret void
}
-; CHECK: define void @f()
-; CHECK: call i64 @llvm.objectsize.i64.p0(
-
define void @bdos_cmpm1(i64 %alloc) {
+; CHECK-LABEL: define void @bdos_cmpm1
+; CHECK-SAME: (i64 [[ALLOC:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 [[ALLOC]])
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ne i64 [[ALLOC]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
+; CHECK-NEXT: br i1 false, label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: call void @fortified_chk(ptr [[OBJ]], i64 [[ALLOC]])
+; CHECK-NEXT: br label [[IF_END:%.*]]
+; CHECK: if.else:
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: ret void
+;
entry:
%obj = call ptr @malloc(i64 %alloc)
%objsize = call i64 @llvm.objectsize.i64.p0(ptr %obj, i1 0, i1 0, i1 1)
@@ -120,13 +169,23 @@ if.end: ; preds = %if.else, %if.then
ret void
}
-; CHECK: define void @bdos_cmpm1(
-; CHECK: [[TMP:%.*]] = icmp ne i64 %alloc, -1
-; CHECK-NEXT: call void @llvm.assume(i1 [[TMP]])
-; CHECK-NEXT: br i1 false, label %if.else, label %if.then
-; CHECK: call void @fortified_chk(ptr %obj, i64 %alloc)
-
define void @bdos_cmpm1_expr(i64 %alloc, i64 %part) {
+; CHECK-LABEL: define void @bdos_cmpm1_expr
+; CHECK-SAME: (i64 [[ALLOC:%.*]], i64 [[PART:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[SZ:%.*]] = udiv i64 [[ALLOC]], [[PART]]
+; CHECK-NEXT: [[OBJ:%.*]] = call ptr @malloc(i64 [[SZ]])
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ne i64 [[SZ]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
+; CHECK-NEXT: br i1 false, label [[IF_ELSE:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: call void @fortified_chk(ptr [[OBJ]], i64 [[SZ]])
+; CHECK-NEXT: br label [[IF_END:%.*]]
+; CHECK: if.else:
+; CHECK-NEXT: br label [[IF_END]]
+; CHECK: if.end:
+; CHECK-NEXT: ret void
+;
entry:
%sz = udiv i64 %alloc, %part
%obj = call ptr @malloc(i64 %sz)
@@ -146,23 +205,20 @@ if.end: ; preds = %if.else, %if.then
ret void
}
-; CHECK: define void @bdos_cmpm1_expr(
-; CHECK: [[TMP:%.*]] = icmp ne i64 [[SZ:%.*]], -1
-; CHECK-NEXT: call void @llvm.assume(i1 [[TMP]])
-; CHECK-NEXT: br i1 false, label %if.else, label %if.then
-; CHECK: call void @fortified_chk(ptr %obj, i64 [[SZ]])
-
@p7 = internal addrspace(7) global i8 0
; Gracefully handle AS cast when the address spaces have
diff erent pointer widths.
define i64 @as_cast(i1 %c) {
-; CHECK: [[TMP0:%.*]] = select i1 %c, i64 64, i64 1
-; CHECK: [[NOT:%.*]] = xor i1 %c, true
-; CHECK: [[NEG:%.*]] = sext i1 [[NOT]] to i64
-; CHECK: [[TMP1:%.*]] = add nsw i64 [[TMP0]], [[NEG]]
-; CHECK: [[TMP2:%.*]] = icmp ne i64 [[TMP1]], -1
-; CHECK: call void @llvm.assume(i1 [[TMP2]])
-; CHECK: ret i64 [[TMP1]]
+; CHECK-LABEL: define i64 @as_cast
+; CHECK-SAME: (i1 [[C:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = select i1 [[C]], i64 64, i64 1
+; CHECK-NEXT: [[NOT_C:%.*]] = xor i1 [[C]], true
+; CHECK-NEXT: [[DOTNEG:%.*]] = sext i1 [[NOT_C]] to i64
+; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[TMP0]], [[DOTNEG]]
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i64 [[TMP1]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[TMP2]])
+; CHECK-NEXT: ret i64 [[TMP1]]
;
entry:
%p0 = tail call ptr @malloc(i64 64)
@@ -174,13 +230,16 @@ entry:
}
define i64 @constexpr_as_cast(i1 %c) {
-; CHECK: [[TMP0:%.*]] = select i1 %c, i64 64, i64 1
-; CHECK: [[NOT:%.*]] = xor i1 %c, true
-; CHECK: [[NEG:%.*]] = sext i1 [[NOT]] to i64
-; CHECK: [[TMP1:%.*]] = add nsw i64 [[TMP0]], [[NEG]]
-; CHECK: [[TMP2:%.*]] = icmp ne i64 [[TMP1]], -1
-; CHECK: call void @llvm.assume(i1 [[TMP2]])
-; CHECK: ret i64 [[TMP1]]
+; CHECK-LABEL: define i64 @constexpr_as_cast
+; CHECK-SAME: (i1 [[C:%.*]]) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = select i1 [[C]], i64 64, i64 1
+; CHECK-NEXT: [[NOT_C:%.*]] = xor i1 [[C]], true
+; CHECK-NEXT: [[DOTNEG:%.*]] = sext i1 [[NOT_C]] to i64
+; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[TMP0]], [[DOTNEG]]
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i64 [[TMP1]], -1
+; CHECK-NEXT: call void @llvm.assume(i1 [[TMP2]])
+; CHECK-NEXT: ret i64 [[TMP1]]
;
entry:
%p0 = tail call ptr @malloc(i64 64)
More information about the llvm-commits
mailing list