[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / Transforms / SCCP / overdefined-ext.ll
blob217daa750cc1da194d98ed58a128153ced05b7d1
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=sccp -S | FileCheck %s
4 define i32 @zext_lshr(i1 %t0) {
5 ; CHECK-LABEL: @zext_lshr(
6 ; CHECK-NEXT:    [[T1:%.*]] = zext i1 [[T0:%.*]] to i32
7 ; CHECK-NEXT:    ret i32 0
9   %t1 = zext i1 %t0 to i32
10   %t2 = lshr i32 %t1, 1
11   ret i32 %t2
14 define i1 @zext_icmp(i1 %t0) {
15 ; CHECK-LABEL: @zext_icmp(
16 ; CHECK-NEXT:    [[T1:%.*]] = zext i1 [[T0:%.*]] to i32
17 ; CHECK-NEXT:    ret i1 false
19   %t1 = zext i1 %t0 to i32
20   %t2 = icmp eq i32 %t1, 2
21   ret i1 %t2
24 ; negative test. SCCP operates poorly with vector ranges
26 define <2 x i1> @zext_vector(<2 x i1> %t0) {
27 ; CHECK-LABEL: @zext_vector(
28 ; CHECK-NEXT:    [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
29 ; CHECK-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], <i32 2, i32 2>
30 ; CHECK-NEXT:    ret <2 x i1> [[T2]]
32   %t1 = zext <2 x i1> %t0 to <2 x i32>
33   %t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>
34   ret <2 x i1> %t2
37 ; negative test. SCCP operates poorly with vector ranges
39 define <2 x i1> @zext_vector2(<2 x i1> %t0) {
40 ; CHECK-LABEL: @zext_vector2(
41 ; CHECK-NEXT:    [[T1:%.*]] = zext <2 x i1> [[T0:%.*]] to <2 x i32>
42 ; CHECK-NEXT:    [[T2:%.*]] = add <2 x i32> [[T1]], <i32 2, i32 2>
43 ; CHECK-NEXT:    [[T3:%.*]] = icmp eq <2 x i32> [[T1]], [[T2]]
44 ; CHECK-NEXT:    ret <2 x i1> [[T3]]
46   %t1 = zext <2 x i1> %t0 to <2 x i32>
47   %t2 = add <2 x i32> %t1, <i32 2, i32 2>
48   %t3 = icmp eq <2 x i32> %t1, %t2
49   ret <2 x i1> %t3
52 ; negative test: %t2 can be replaced by %t1, but SCCP operates by ranges only
54 define i32 @sext_ashr(i1 %t0) {
55 ; CHECK-LABEL: @sext_ashr(
56 ; CHECK-NEXT:    [[T1:%.*]] = sext i1 [[T0:%.*]] to i32
57 ; CHECK-NEXT:    [[T2:%.*]] = ashr i32 [[T1]], 1
58 ; CHECK-NEXT:    ret i32 [[T2]]
60   %t1 = sext i1 %t0 to i32
61   %t2 = ashr i32 %t1, 1
62   ret i32 %t2
65 define i1 @sext_icmp(i1 %t0) {
66 ; CHECK-LABEL: @sext_icmp(
67 ; CHECK-NEXT:    [[T1:%.*]] = sext i1 [[T0:%.*]] to i32
68 ; CHECK-NEXT:    ret i1 false
70   %t1 = sext i1 %t0 to i32
71   %t2 = icmp eq i32 %t1, 2
72   ret i1 %t2
75 ; negative test. SCCP operates poorly with vector ranges
77 define <2 x i1> @sext_vector(<2 x i1> %t0) {
78 ; CHECK-LABEL: @sext_vector(
79 ; CHECK-NEXT:    [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
80 ; CHECK-NEXT:    [[T2:%.*]] = icmp eq <2 x i32> [[T1]], <i32 2, i32 2>
81 ; CHECK-NEXT:    ret <2 x i1> [[T2]]
83   %t1 = sext <2 x i1> %t0 to <2 x i32>
84   %t2 = icmp eq <2 x i32> %t1, <i32 2, i32 2>
85   ret <2 x i1> %t2
88 ; negative test. SCCP operates poorly with vector ranges
90 define <2 x i1> @sext_vector2(<2 x i1> %t0) {
91 ; CHECK-LABEL: @sext_vector2(
92 ; CHECK-NEXT:    [[T1:%.*]] = sext <2 x i1> [[T0:%.*]] to <2 x i32>
93 ; CHECK-NEXT:    [[T2:%.*]] = add <2 x i32> [[T1]], <i32 2, i32 2>
94 ; CHECK-NEXT:    [[T3:%.*]] = icmp eq <2 x i32> [[T1]], [[T2]]
95 ; CHECK-NEXT:    ret <2 x i1> [[T3]]
97   %t1 = sext <2 x i1> %t0 to <2 x i32>
98   %t2 = add <2 x i32> %t1, <i32 2, i32 2>
99   %t3 = icmp eq <2 x i32> %t1, %t2
100   ret <2 x i1> %t3