1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Transforms/GVN/assume.ll
Nikita Popov 868b57b4b2 [GVN] Use that assume(!X) implies X==false (PR47496)
We already use that assume(X) implies X==true, do the same for
assume(!X) implying X==false. This fixes PR47496.
2020-09-17 21:34:44 +02:00

45 lines
1.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -gvn -S | FileCheck %s
declare void @llvm.assume(i1)
declare void @use(i1)
define void @assume_arg(i1 %x) {
; CHECK-LABEL: @assume_arg(
; CHECK-NEXT: call void @llvm.assume(i1 [[X:%.*]])
; CHECK-NEXT: call void @use(i1 true)
; CHECK-NEXT: ret void
;
call void @llvm.assume(i1 %x)
call void @use(i1 %x)
ret void
}
define void @assume_not_arg(i1 %x) {
; CHECK-LABEL: @assume_not_arg(
; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[X:%.*]], true
; CHECK-NEXT: call void @llvm.assume(i1 [[XOR]])
; CHECK-NEXT: call void @use(i1 false)
; CHECK-NEXT: ret void
;
%xor = xor i1 %x, true
call void @llvm.assume(i1 %xor)
call void @use(i1 %x)
ret void
}
define void @pr47496(i8 %x) {
; CHECK-LABEL: @pr47496(
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], 0
; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[CMP]], true
; CHECK-NEXT: call void @llvm.assume(i1 [[XOR]])
; CHECK-NEXT: call void @use(i1 false)
; CHECK-NEXT: ret void
;
%cmp = icmp slt i8 %x, 0
%xor = xor i1 %cmp, true
call void @llvm.assume(i1 %xor)
call void @use(i1 %cmp)
ret void
}