[llvm] 4cfb4af - [InstCombine] Highlight tests using expensive combines; NFC

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 08:59:31 PST 2020


Author: Nikita Popov
Date: 2020-03-07T17:16:47+01:00
New Revision: 4cfb4afb705347a641bda53058af0f15f085e908

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

LOG: [InstCombine] Highlight tests using expensive combines; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/all-bits-shift.ll
    llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
    llvm/test/Transforms/InstCombine/phi-shifts.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/all-bits-shift.ll b/llvm/test/Transforms/InstCombine/all-bits-shift.ll
index a035f53d1aa2..8ac9bc1195c7 100644
--- a/llvm/test/Transforms/InstCombine/all-bits-shift.ll
+++ b/llvm/test/Transforms/InstCombine/all-bits-shift.ll
@@ -1,4 +1,6 @@
-; RUN: opt -S -instcombine -expensive-combines < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -instcombine -expensive-combines=0 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-OFF
+; RUN: opt -S -instcombine -expensive-combines=1 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-ON
 target datalayout = "E-m:e-i64:64-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
@@ -6,8 +8,39 @@ target triple = "powerpc64-unknown-linux-gnu"
 @b = global i32* @d, align 8
 @a = common global i32 0, align 4
 
-; Function Attrs: nounwind
+; Check that both InstCombine and InstSimplify can use computeKnownBits to
+; realize that:
+;   ((2072 >> (L == 0)) >> 7) & 1
+; is always zero.
 define signext i32 @main() #1 {
+; EXPENSIVE-OFF-LABEL: @main(
+; EXPENSIVE-OFF-NEXT:  entry:
+; EXPENSIVE-OFF-NEXT:    [[TMP0:%.*]] = load i32*, i32** @b, align 8
+; EXPENSIVE-OFF-NEXT:    [[TMP1:%.*]] = load i32, i32* @a, align 4
+; EXPENSIVE-OFF-NEXT:    [[LNOT:%.*]] = icmp eq i32 [[TMP1]], 0
+; EXPENSIVE-OFF-NEXT:    [[LNOT_EXT:%.*]] = zext i1 [[LNOT]] to i32
+; EXPENSIVE-OFF-NEXT:    [[SHR_I:%.*]] = lshr i32 2072, [[LNOT_EXT]]
+; EXPENSIVE-OFF-NEXT:    [[CALL_LOBIT:%.*]] = lshr i32 [[SHR_I]], 7
+; EXPENSIVE-OFF-NEXT:    [[TMP2:%.*]] = and i32 [[CALL_LOBIT]], 1
+; EXPENSIVE-OFF-NEXT:    [[TMP3:%.*]] = load i32, i32* [[TMP0]], align 4
+; EXPENSIVE-OFF-NEXT:    [[OR:%.*]] = or i32 [[TMP2]], [[TMP3]]
+; EXPENSIVE-OFF-NEXT:    store i32 [[OR]], i32* [[TMP0]], align 4
+; EXPENSIVE-OFF-NEXT:    [[TMP4:%.*]] = load i32, i32* @a, align 4
+; EXPENSIVE-OFF-NEXT:    [[LNOT_1:%.*]] = icmp eq i32 [[TMP4]], 0
+; EXPENSIVE-OFF-NEXT:    [[LNOT_EXT_1:%.*]] = zext i1 [[LNOT_1]] to i32
+; EXPENSIVE-OFF-NEXT:    [[SHR_I_1:%.*]] = lshr i32 2072, [[LNOT_EXT_1]]
+; EXPENSIVE-OFF-NEXT:    [[CALL_LOBIT_1:%.*]] = lshr i32 [[SHR_I_1]], 7
+; EXPENSIVE-OFF-NEXT:    [[TMP5:%.*]] = and i32 [[CALL_LOBIT_1]], 1
+; EXPENSIVE-OFF-NEXT:    [[OR_1:%.*]] = or i32 [[TMP5]], [[TMP3]]
+; EXPENSIVE-OFF-NEXT:    store i32 [[OR_1]], i32* [[TMP0]], align 4
+; EXPENSIVE-OFF-NEXT:    ret i32 [[OR_1]]
+;
+; EXPENSIVE-ON-LABEL: @main(
+; EXPENSIVE-ON-NEXT:  entry:
+; EXPENSIVE-ON-NEXT:    [[TMP0:%.*]] = load i32*, i32** @b, align 8
+; EXPENSIVE-ON-NEXT:    [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4
+; EXPENSIVE-ON-NEXT:    ret i32 [[TMP1]]
+;
 entry:
   %0 = load i32*, i32** @b, align 8
   %1 = load i32, i32* @a, align 4
@@ -29,15 +62,6 @@ entry:
   store i32 %or.1, i32* %0, align 4
   ret i32 %or.1
 
-; Check that both InstCombine and InstSimplify can use computeKnownBits to
-; realize that:
-;   ((2072 >> (L == 0)) >> 7) & 1
-; is always zero.
-
-; CHECK-LABEL: @main
-; CHECK: %[[V1:[0-9]+]] = load i32*, i32** @b, align 8
-; CHECK: %[[V2:[0-9]+]] = load i32, i32* %[[V1]], align 4
-; CHECK: ret i32 %[[V2]]
 }
 
 attributes #0 = { nounwind readnone }

diff  --git a/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll b/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
index 02be57a4d152..5c1867f81006 100644
--- a/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
+++ b/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
@@ -1,13 +1,20 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt -S -instcombine -expensive-combines=0 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-OFF
+; RUN: opt -S -instcombine -expensive-combines=1 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-ON
 ; Check that we don't crash on unreasonable constant indexes
 
 define i32 @test_out_of_bounds(i32 %a, i1 %x, i1 %y) {
-; CHECK-LABEL: @test_out_of_bounds(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[A:%.*]], 3
-; CHECK-NEXT:    tail call void @llvm.assume(i1 false)
-; CHECK-NEXT:    ret i32 [[AND1]]
+; EXPENSIVE-OFF-LABEL: @test_out_of_bounds(
+; EXPENSIVE-OFF-NEXT:  entry:
+; EXPENSIVE-OFF-NEXT:    [[AND1:%.*]] = and i32 [[A:%.*]], 3
+; EXPENSIVE-OFF-NEXT:    tail call void @llvm.assume(i1 undef)
+; EXPENSIVE-OFF-NEXT:    ret i32 [[AND1]]
+;
+; EXPENSIVE-ON-LABEL: @test_out_of_bounds(
+; EXPENSIVE-ON-NEXT:  entry:
+; EXPENSIVE-ON-NEXT:    [[AND1:%.*]] = and i32 [[A:%.*]], 3
+; EXPENSIVE-ON-NEXT:    tail call void @llvm.assume(i1 false)
+; EXPENSIVE-ON-NEXT:    ret i32 [[AND1]]
 ;
 entry:
   %and1 = and i32 %a, 3
@@ -18,10 +25,15 @@ entry:
 }
 
 define i128 @test_non64bit(i128 %a) {
-; CHECK-LABEL: @test_non64bit(
-; CHECK-NEXT:    [[AND1:%.*]] = and i128 [[A:%.*]], 3
-; CHECK-NEXT:    tail call void @llvm.assume(i1 false)
-; CHECK-NEXT:    ret i128 [[AND1]]
+; EXPENSIVE-OFF-LABEL: @test_non64bit(
+; EXPENSIVE-OFF-NEXT:    [[AND1:%.*]] = and i128 [[A:%.*]], 3
+; EXPENSIVE-OFF-NEXT:    tail call void @llvm.assume(i1 undef)
+; EXPENSIVE-OFF-NEXT:    ret i128 [[AND1]]
+;
+; EXPENSIVE-ON-LABEL: @test_non64bit(
+; EXPENSIVE-ON-NEXT:    [[AND1:%.*]] = and i128 [[A:%.*]], 3
+; EXPENSIVE-ON-NEXT:    tail call void @llvm.assume(i1 false)
+; EXPENSIVE-ON-NEXT:    ret i128 [[AND1]]
 ;
   %and1 = and i128 %a, 3
   %B = lshr i128 %and1, -1

diff  --git a/llvm/test/Transforms/InstCombine/phi-shifts.ll b/llvm/test/Transforms/InstCombine/phi-shifts.ll
index cc36c9d9e25b..af94d8b4001b 100644
--- a/llvm/test/Transforms/InstCombine/phi-shifts.ll
+++ b/llvm/test/Transforms/InstCombine/phi-shifts.ll
@@ -1,15 +1,24 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -S -instcombine | FileCheck %s
+; RUN: opt -S -instcombine -expensive-combines=0 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-OFF
+; RUN: opt -S -instcombine -expensive-combines=1 < %s | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-ON
 
 ; OSS Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15217
 define i64 @fuzz15217(i1 %cond, i8* %Ptr, i64 %Val) {
-; CHECK-LABEL: @fuzz15217(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br i1 [[COND:%.*]], label [[END:%.*]], label [[TWO:%.*]]
-; CHECK:       two:
-; CHECK-NEXT:    br label [[END]]
-; CHECK:       end:
-; CHECK-NEXT:    ret i64 0
+; EXPENSIVE-OFF-LABEL: @fuzz15217(
+; EXPENSIVE-OFF-NEXT:  entry:
+; EXPENSIVE-OFF-NEXT:    br i1 [[COND:%.*]], label [[END:%.*]], label [[TWO:%.*]]
+; EXPENSIVE-OFF:       two:
+; EXPENSIVE-OFF-NEXT:    br label [[END]]
+; EXPENSIVE-OFF:       end:
+; EXPENSIVE-OFF-NEXT:    ret i64 undef
+;
+; EXPENSIVE-ON-LABEL: @fuzz15217(
+; EXPENSIVE-ON-NEXT:  entry:
+; EXPENSIVE-ON-NEXT:    br i1 [[COND:%.*]], label [[END:%.*]], label [[TWO:%.*]]
+; EXPENSIVE-ON:       two:
+; EXPENSIVE-ON-NEXT:    br label [[END]]
+; EXPENSIVE-ON:       end:
+; EXPENSIVE-ON-NEXT:    ret i64 0
 ;
 entry:
   br i1 %cond, label %end, label %two


        


More information about the llvm-commits mailing list