1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=gvn -verify-analysis-invalidation -S | FileCheck %s
4 declare void @llvm.assume(i1)
7 define void @assume_true() {
8 ; CHECK-LABEL: @assume_true(
11 call void @llvm.assume(i1 true)
15 define void @assume_false() {
16 ; CHECK-LABEL: @assume_false(
17 ; CHECK-NEXT: store i8 poison, ptr null, align 1
18 ; CHECK-NEXT: ret void
20 call void @llvm.assume(i1 false)
24 define void @assume_arg(i1 %x) {
25 ; CHECK-LABEL: @assume_arg(
26 ; CHECK-NEXT: call void @llvm.assume(i1 [[X:%.*]])
27 ; CHECK-NEXT: call void @use(i1 true)
28 ; CHECK-NEXT: ret void
30 call void @llvm.assume(i1 %x)
35 define void @assume_not_arg(i1 %x) {
36 ; CHECK-LABEL: @assume_not_arg(
37 ; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[X:%.*]], true
38 ; CHECK-NEXT: call void @llvm.assume(i1 [[XOR]])
39 ; CHECK-NEXT: call void @use(i1 false)
40 ; CHECK-NEXT: ret void
42 %xor = xor i1 %x, true
43 call void @llvm.assume(i1 %xor)
48 define void @pr47496(i8 %x) {
49 ; CHECK-LABEL: @pr47496(
50 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], 0
51 ; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[CMP]], true
52 ; CHECK-NEXT: call void @llvm.assume(i1 [[XOR]])
53 ; CHECK-NEXT: call void @use(i1 false)
54 ; CHECK-NEXT: ret void
56 %cmp = icmp slt i8 %x, 0
57 %xor = xor i1 %cmp, true
58 call void @llvm.assume(i1 %xor)
59 call void @use(i1 %cmp)