1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[InstCombine] Split assume test in expensive and not; NFC

The IR difference in @icmp1 serves as a test for D72864.
This commit is contained in:
Nikita Popov 2020-01-16 21:33:04 +01:00
parent 963471fb57
commit d31158ae0f

View File

@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s
; RUN: opt < %s -instcombine -S | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-ON
; RUN: opt < %s -instcombine -expensive-combines=0 -S | FileCheck %s --check-prefixes=CHECK,EXPENSIVE-OFF
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@ -189,10 +190,16 @@ entry:
}
define i32 @icmp1(i32 %a) #0 {
; CHECK-LABEL: @icmp1(
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A:%.*]], 5
; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP]])
; CHECK-NEXT: ret i32 1
; EXPENSIVE-ON-LABEL: @icmp1(
; EXPENSIVE-ON-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A:%.*]], 5
; EXPENSIVE-ON-NEXT: tail call void @llvm.assume(i1 [[CMP]])
; EXPENSIVE-ON-NEXT: ret i32 1
;
; EXPENSIVE-OFF-LABEL: @icmp1(
; EXPENSIVE-OFF-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A:%.*]], 5
; EXPENSIVE-OFF-NEXT: tail call void @llvm.assume(i1 [[CMP]])
; EXPENSIVE-OFF-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
; EXPENSIVE-OFF-NEXT: ret i32 1
;
%cmp = icmp sgt i32 %a, 5
tail call void @llvm.assume(i1 %cmp)
@ -331,9 +338,16 @@ define i1 @nonnull5(i32** %a) {
; PR35846 - https://bugs.llvm.org/show_bug.cgi?id=35846
define i32 @assumption_conflicts_with_known_bits(i32 %a, i32 %b) {
; CHECK-LABEL: @assumption_conflicts_with_known_bits(
; CHECK-NEXT: tail call void @llvm.assume(i1 false)
; CHECK-NEXT: ret i32 0
; EXPENSIVE-ON-LABEL: @assumption_conflicts_with_known_bits(
; EXPENSIVE-ON-NEXT: tail call void @llvm.assume(i1 false)
; EXPENSIVE-ON-NEXT: ret i32 0
;
; EXPENSIVE-OFF-LABEL: @assumption_conflicts_with_known_bits(
; EXPENSIVE-OFF-NEXT: [[AND1:%.*]] = and i32 [[B:%.*]], 3
; EXPENSIVE-OFF-NEXT: tail call void @llvm.assume(i1 false)
; EXPENSIVE-OFF-NEXT: [[CMP2:%.*]] = icmp eq i32 [[AND1]], 0
; EXPENSIVE-OFF-NEXT: tail call void @llvm.assume(i1 [[CMP2]])
; EXPENSIVE-OFF-NEXT: ret i32 0
;
%and1 = and i32 %b, 3
%B1 = lshr i32 %and1, %and1