[LLVMdev] Canonicalization of ptrtoint/inttoptr and getelementptr

David Majnemer david.majnemer at gmail.com
Sat Aug 30 18:01:57 PDT 2014


Consider the two functions bellow:

define i8* @f(i8* %A) {  %pti = ptrtoint i8* %A to i64  %add = add i64
%pti, 5  %itp = inttoptr i64 %add to i8*  ret i8* %itp}
define i8* @g(i8* %A) {
  %gep = getelementptr i8* %A, i64 5  ret i8* %gep}
What, if anything, prevents us from canonicalizing @f to @g?I've heard that
this might be in violation of
http://llvm.org/docs/LangRef.html#pointeraliasing but I don't see how.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140830/8cdfddda/attachment.html>


More information about the llvm-dev mailing list