[PATCH] D19276: folding compares if pointers do not escape
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 07:26:43 PDT 2016
anna added inline comments.
================
Comment at: test/Transforms/InstCombine/compared-unescaped.ll:35
@@ +34,3 @@
+ %lgp = load i32*, i32** @gp, align 8
+ %cmp = icmp eq i32* %bc, %lgp
+ %rt = zext i1 %cmp to i32
----------------
majnemer wrote:
> reames wrote:
> > This test case is a great example of what I mentioned to you on the phone the other day. Regardless of whether we can elide the call to malloc, we should be able to fold this comparison to false.
> >
> > To be clear, I am not suggesting you change the current change (LGTM as well). This would be useful future work though.
> Perhaps a FIXME should get added?
Agreed. We already have the check for nocapture operands in PointerMayBeCaptured. This specific case may be ok to add in the icmp case in PointerMayBeCaptured.
Also, I think the call to malloc cannot be elided in this case (since it may actually be leveraging the functionality of malloc + the function `f` deopt call). The malloc call will be elided if the IR is such that the call to function f is dce'd based on `%cmp` .
http://reviews.llvm.org/D19276
More information about the llvm-commits
mailing list