1 ; RUN: opt < %s -instsimplify -S | FileCheck %s
2 target datalayout = "p:32:32"
4 ; Check some past-the-end subtleties.
9 ; Comparing base addresses of two distinct globals. Never equal.
11 define zeroext i1 @no_offsets() {
12 %t = icmp eq i32* @opte_a, @opte_b
18 ; Comparing past-the-end addresses of two distinct globals. Never equal.
20 define zeroext i1 @both_past_the_end() {
21 %x = getelementptr i32* @opte_a, i32 1
22 %y = getelementptr i32* @opte_b, i32 1
23 %t = icmp eq i32* %x, %y
25 ; CHECK: both_past_the_end(
26 ; CHECK-NOT: ret i1 true
30 ; Comparing past-the-end addresses of one global to the base address
31 ; of another. Can't fold this.
33 define zeroext i1 @just_one_past_the_end() {
34 %x = getelementptr i32* @opte_a, i32 1
35 %t = icmp eq i32* %x, @opte_b
37 ; CHECK: just_one_past_the_end(
38 ; CHECK: ret i1 icmp eq (i32* getelementptr inbounds (i32* @opte_a, i32 1), i32* @opte_b)
41 ; Comparing base addresses of two distinct allocas. Never equal.
43 define zeroext i1 @no_alloca_offsets() {
46 %t = icmp eq i32* %m, %n
48 ; CHECK: no_alloca_offsets(
52 ; Comparing past-the-end addresses of two distinct allocas. Never equal.
54 define zeroext i1 @both_past_the_end_alloca() {
57 %x = getelementptr i32* %m, i32 1
58 %y = getelementptr i32* %n, i32 1
59 %t = icmp eq i32* %x, %y
61 ; CHECK: both_past_the_end_alloca(
62 ; CHECK-NOT: ret i1 true
66 ; Comparing past-the-end addresses of one alloca to the base address
67 ; of another. Can't fold this.
69 define zeroext i1 @just_one_past_the_end_alloca() {
72 %x = getelementptr i32* %m, i32 1
73 %t = icmp eq i32* %x, %n
75 ; CHECK: just_one_past_the_end_alloca(