Distribute sext/zext to the operands of and/or/xor
[oota-llvm.git] / test / Assembler / ConstantExprNoFold.ll
1 ; This test checks to make sure that constant exprs don't fold in some simple
2 ; situations
3
4 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
5
6 ; Even give it a datalayout, to tempt folding as much as possible.
7 target datalayout = "p:32:32"
8
9 @A = global i64 0
10 @B = global i64 0
11
12 ; Don't fold this. @A might really be allocated next to @B, in which case the
13 ; icmp should return true. It's not valid to *dereference* in @B from a pointer
14 ; based on @A, but icmp isn't a dereference.
15
16 ; CHECK: @C = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* @B)
17 @C = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* @B)
18
19 ; Don't fold this completely away either. In theory this could be simplified
20 ; to only use a gep on one side of the icmp though.
21
22 ; CHECK: @D = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* getelementptr inbounds (i64* @B, i64 2))
23 @D = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* getelementptr inbounds (i64* @B, i64 2))
24
25 ; CHECK: @E = global i64 addrspace(1)* addrspacecast (i64* @A to i64 addrspace(1)*)
26 @E = global i64 addrspace(1)* addrspacecast(i64* @A to i64 addrspace(1)*)