Rewrite instsimplify's handling if icmp on pointer values to remove the

remaining use of AliasAnalysis concepts such as isIdentifiedObject to
prove pointer inequality.

@external_compare in test/Transforms/InstSimplify/compare.ll shows a simple
case where a noalias argument can be equal to a global variable address, and
while AliasAnalysis can get away with saying that these pointers don't alias,
instsimplify cannot say that they are not equal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2013-02-01 00:11:13 +00:00
parent 3529d1aa8d
commit fdd1eafe86
2 changed files with 110 additions and 56 deletions
+22
View File
@@ -660,3 +660,25 @@ define i1 @alloca_argument_compare(i64* %arg) {
; CHECK: alloca_argument_compare
; CHECK: ret i1 %cmp
}
; As above, but with the operands reversed.
define i1 @alloca_argument_compare_swapped(i64* %arg) {
%alloc = alloca i64
%cmp = icmp eq i64* %alloc, %arg
ret i1 %cmp
; CHECK: alloca_argument_compare_swapped
; CHECK: ret i1 %cmp
}
; Don't assume that a noalias argument isn't equal to a global variable's
; address. This is an example where AliasAnalysis' NoAlias concept is
; different from actual pointer inequality.
@y = external global i32
define zeroext i1 @external_compare(i32* noalias %x) {
%cmp = icmp eq i32* %x, @y
ret i1 %cmp
; CHECK: external_compare
; CHECK: ret i1 %cmp
}