2013-01-31 00:01:45 +00:00
|
|
|
; This test checks to make sure that constant exprs don't fold in some simple
|
|
|
|
; situations
|
|
|
|
|
|
|
|
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
|
2014-07-31 18:46:24 +00:00
|
|
|
; RUN: verify-uselistorder %s -preserve-bc-use-list-order
|
2013-01-31 00:01:45 +00:00
|
|
|
|
|
|
|
; Even give it a datalayout, to tempt folding as much as possible.
|
|
|
|
target datalayout = "p:32:32"
|
|
|
|
|
|
|
|
@A = global i64 0
|
|
|
|
@B = global i64 0
|
|
|
|
|
|
|
|
; Don't fold this. @A might really be allocated next to @B, in which case the
|
|
|
|
; icmp should return true. It's not valid to *dereference* in @B from a pointer
|
|
|
|
; based on @A, but icmp isn't a dereference.
|
|
|
|
|
|
|
|
; CHECK: @C = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* @B)
|
|
|
|
@C = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* @B)
|
|
|
|
|
|
|
|
; Don't fold this completely away either. In theory this could be simplified
|
|
|
|
; to only use a gep on one side of the icmp though.
|
|
|
|
|
|
|
|
; CHECK: @D = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* getelementptr inbounds (i64* @B, i64 2))
|
|
|
|
@D = global i1 icmp eq (i64* getelementptr inbounds (i64* @A, i64 1), i64* getelementptr inbounds (i64* @B, i64 2))
|
2013-11-15 01:34:59 +00:00
|
|
|
|
|
|
|
; CHECK: @E = global i64 addrspace(1)* addrspacecast (i64* @A to i64 addrspace(1)*)
|
|
|
|
@E = global i64 addrspace(1)* addrspacecast(i64* @A to i64 addrspace(1)*)
|
2014-08-16 01:54:32 +00:00
|
|
|
|
|
|
|
; Don't add an inbounds on @weak.gep, since @weak may be null.
|
|
|
|
; CHECK: @weak.gep = global i32* getelementptr (i32* @weak, i32 1)
|
|
|
|
@weak.gep = global i32* getelementptr (i32* @weak, i32 1)
|
|
|
|
@weak = extern_weak global i32
|
|
|
|
|
|
|
|
; Don't add an inbounds on @glob.a3, since it's not inbounds.
|
|
|
|
; CHECK: @glob.a3 = alias getelementptr (i32* @glob.a2, i32 1)
|
|
|
|
@glob = global i32 0
|
|
|
|
@glob.a3 = alias getelementptr (i32* @glob.a2, i32 1)
|
|
|
|
@glob.a2 = alias getelementptr (i32* @glob.a1, i32 1)
|
|
|
|
@glob.a1 = alias i32* @glob
|