From a6f2a1ecaaa83ea211c8fbb12edbccda39859d74 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 18 Feb 2025 17:11:07 +0100 Subject: [PATCH] [SCEV] Generate test checks (NFC) --- .../ScalarEvolution/trunc-simplify.ll | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/llvm/test/Analysis/ScalarEvolution/trunc-simplify.ll b/llvm/test/Analysis/ScalarEvolution/trunc-simplify.ll index f26478cb13fa..b461b6a600c6 100644 --- a/llvm/test/Analysis/ScalarEvolution/trunc-simplify.ll +++ b/llvm/test/Analysis/ScalarEvolution/trunc-simplify.ll @@ -1,13 +1,19 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5 ; RUN: opt < %s -disable-output "-passes=print" 2>&1 | FileCheck %s ; Check that we convert ; trunc(C * a) -> trunc(C) * trunc(a) ; if C is a constant. -; CHECK-LABEL: @trunc_of_mul define i8 @trunc_of_mul(i32 %a) { +; CHECK-LABEL: 'trunc_of_mul' +; CHECK-NEXT: Classifying expressions for: @trunc_of_mul +; CHECK-NEXT: %b = mul i32 %a, 100 +; CHECK-NEXT: --> (100 * %a) U: [0,-3) S: [-2147483648,2147483645) +; CHECK-NEXT: %c = trunc i32 %b to i8 +; CHECK-NEXT: --> (100 * (trunc i32 %a to i8)) U: [0,-3) S: [-128,125) +; CHECK-NEXT: Determining loop execution counts for: @trunc_of_mul +; %b = mul i32 %a, 100 - ; CHECK: %c - ; CHECK-NEXT: --> (100 * (trunc i32 %a to i8)) %c = trunc i32 %b to i8 ret i8 %c } @@ -15,31 +21,43 @@ define i8 @trunc_of_mul(i32 %a) { ; Check that we convert ; trunc(C + a) -> trunc(C) + trunc(a) ; if C is a constant. -; CHECK-LABEL: @trunc_of_add define i8 @trunc_of_add(i32 %a) { +; CHECK-LABEL: 'trunc_of_add' +; CHECK-NEXT: Classifying expressions for: @trunc_of_add +; CHECK-NEXT: %b = add i32 %a, 100 +; CHECK-NEXT: --> (100 + %a) U: full-set S: full-set +; CHECK-NEXT: %c = trunc i32 %b to i8 +; CHECK-NEXT: --> (100 + (trunc i32 %a to i8)) U: full-set S: full-set +; CHECK-NEXT: Determining loop execution counts for: @trunc_of_add +; %b = add i32 %a, 100 - ; CHECK: %c - ; CHECK-NEXT: --> (100 + (trunc i32 %a to i8)) %c = trunc i32 %b to i8 ret i8 %c } ; Check that we truncate to zero values assumed to have at least as many ; trailing zeros as the target type. -; CHECK-LABEL: @trunc_to_assumed_zeros define i8 @trunc_to_assumed_zeros(ptr %p) { +; CHECK-LABEL: 'trunc_to_assumed_zeros' +; CHECK-NEXT: Classifying expressions for: @trunc_to_assumed_zeros +; CHECK-NEXT: %a = load i32, ptr %p, align 4 +; CHECK-NEXT: --> %a U: [0,-255) S: [-2147483648,2147483393) +; CHECK-NEXT: %and = and i32 %a, 255 +; CHECK-NEXT: --> 0 U: [0,1) S: [0,1) +; CHECK-NEXT: %c = trunc i32 %a to i8 +; CHECK-NEXT: --> 0 U: [0,1) S: [0,1) +; CHECK-NEXT: %d = trunc i32 %a to i1 +; CHECK-NEXT: --> false U: [0,-1) S: [0,-1) +; CHECK-NEXT: %e = trunc i32 %a to i16 +; CHECK-NEXT: --> (trunc i32 %a to i16) U: [0,-255) S: [-32768,32513) +; CHECK-NEXT: Determining loop execution counts for: @trunc_to_assumed_zeros +; %a = load i32, ptr %p %and = and i32 %a, 255 %cmp = icmp eq i32 %and, 0 tail call void @llvm.assume(i1 %cmp) - ; CHECK: %c - ; CHECK-NEXT: --> 0 %c = trunc i32 %a to i8 - ; CHECK: %d - ; CHECK-NEXT: --> false %d = trunc i32 %a to i1 - ; CHECK: %e - ; CHECK-NEXT: --> (trunc i32 %a to i16) %e = trunc i32 %a to i16 ret i8 %c }