[PATCH] D54170: [InstCombine][SelectionDAG][AArch64] fold gep into select to enable speculation of load

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 12:54:51 PST 2018


labrinea added a comment.

In https://reviews.llvm.org/D54170#1289220, @efriedma wrote:

> This looks like a bunch of separate changes which should be split into multiple patches.  Especially the changes to DAGCombine and InstCombiner::visitZExt .


Sure, I've explained in the description why I put everything together in this revision.



================
Comment at: test/Transforms/InstCombine/gep-select.ll:29
+  %sel = select i1 %cmp, i32* %gep1, i32* %gep2
+  %ld = load i32, i32* %sel, align 4
+  ret i32 %ld
----------------
efriedma wrote:
> I'm pretty sure this isn't safe, in general.  The "inbounds" marker only guarantees that the arithmetic is in bounds; it doesn't make any guarantees about the type of the pointer.
My comment was not referring to the inbounds marker. I am actually looking whether the indices derived from the select fall into the boundaries of a static type. In this example the last index of the geps ( `i32 1` and `i32 2` respectively) indicate valid offsets of struct members (the last two i32 members of struct.A).


https://reviews.llvm.org/D54170





More information about the llvm-commits mailing list