[PATCH] D50248: [GuardWidening] Insert fictive guards to loop preheader to increase chances of widening
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 3 06:01:22 PDT 2018
mkazantsev created this revision.
mkazantsev added reviewers: fedor.sergeev, apilipenko, sanjoy, reames.
Sometimes we have something like:
preheader:
guard(%c1)[];
%c2 =<some cond>;
br i1 %loop
loop:
...
guard(%c2)
...
Despite `%c2` being loop invariant, we cannot widen the 2nd guard into
the 1st one in case if `%c2` is not available at the point of 1st guard. To
solve that situation, we can insert the fictive guard with `true` condition
like this:
preheader:
guard(%c1)[];
%c2 =<some cond>;
guard(true)[];
br i1 %loop
loop:
...
guard(%c2)
...
And then widen the condition of guard in loop into this fictive guard. In case
if it didn't help, we can just safely delete the fictive guard we've just inserted.
https://reviews.llvm.org/D50248
Files:
lib/Transforms/Scalar/GuardWidening.cpp
test/Transforms/GuardWidening/fictive-guards.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50248.158992.patch
Type: text/x-patch
Size: 7893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/d5a7a8bd/attachment.bin>
More information about the llvm-commits
mailing list