[PATCH] D19390: folding compares for distinct allocations
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 16:04:53 PDT 2016
sanjoy added a comment.
For the record, this is the example I was talking about:
%v0 = malloc()
%other = (bitcast (bitcast %v0))
;; two bitcasts to allow bitcasting i8* -> i32* -> i8* or something like that
;; to allow the equality to be properly typed
%result = %other == %v0
Now, as written, I think the above example is fine, since the
traversal order guarantees that we'll visit the `%result` with `PI` as
`%v0` (and bail out of the loop) before we visit `%result` with `PI`
as `%other`. And I think we _can_ make a general argument that if
`isAllocFn` returns `true` for the non `PI` operand then the non `PI`
operand is different from `AI` since if the non `PI` operand was equal
to `AI` then we'd have visited the comparison earlier and bailed out
of the loop. However, this argument is somewhat subtle (for instance,
passing in `true` for `LookThroughBitCast` to `isAllocFn` will break
that), so if we go down that path we should add some relevant asserts
and test cases.
Repository:
rL LLVM
http://reviews.llvm.org/D19390
More information about the llvm-commits
mailing list