[llvm-dev] PHI / Select Simplification
William Moses via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 15 21:28:31 PDT 2019
Hi all,
I'm working on some LLVM 7 code and I was wondering if there exists an
optimization pass (perhaps that exists in a later version of LLVM) that
does the following. Or if not, a good pass for me to implement this inside
of may be.
Suppose you have the following loop:
for: ; preds = %entry, %for
%phi = phi double [ %entry_value, %entry ], [ %selected_value, %for ]
%condition = ...
%selected_value = select i1 %condition, double %inner_value, double
%any_value
br i1 %condition, label %for, label %loop_exit
In this case, (and similarly cases where the loop condition is the same as
the select condition), we may simply replace %selected_value in the for
loop with %inner_value from the select (and therefore remove the select).
This type of structure comes up frequently in some codes I'm looking at and
figured I'd check if anyone has something to deal with it already before I
implement my own (and try to upstream).
Cheers,
Billy Moses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190316/b93d48b2/attachment.html>
More information about the llvm-dev
mailing list