[PATCH] D39906: [InstCombine] Allowing GEP Instructions with loop Invariant operands to combine
DIVYA SHANMUGHAN via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 09:01:48 PST 2017
DIVYA created this revision.
InstCombine pass currently combines GEP Instruction with constant operands to combine .However if there are GEP instructions within a loop,such that the operands of those instructions are either constant or loop invariants, then they should also be combined, so that the LICM pass can move them out of the loop.
For example
do.body: ; preds = %do.cond, %entry
%cur_match.addr.0 = phi i32 [ %cur_match, %entry ], [ %2, %do.cond ]
%idx.ext = zext i32 %cur_match.addr.0 to i64
%add.ptr = getelementptr inbounds i8, i8* %win, i64 %idx.ext
%add.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i64 %idx.ext1
%add.ptr3 = getelementptr inbounds i8, i8* %add.ptr2, i64 -1
In this example i64 %idx.ext1 is loop invariant and i64 -1 is constant, hence they can be combined together.
In collaboration with Sebastian Pop
https://reviews.llvm.org/D39906
Files:
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/gep-combine-loop-invariant.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39906.122449.patch
Type: text/x-patch
Size: 6651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/375e3bf9/attachment.bin>
More information about the llvm-commits
mailing list