forked from OSchip/llvm-project
8a12cae862
This patch extends the available-value logic to detect loads of pointer-selects that can be replaced by a value select. For example, consider the code below: loop: %sel.phi = phi i32* [ %start, %ph ], [ %sel, %ph ] %l = load %ptr %l.sel = load %sel.phi %sel = select cond, %ptr, %sel.phi ... exit: %res = load %sel use(%res) The load of the pointer phi can be replaced by a load of the start value outside the loop and a new phi/select chain based on the loaded values, as illustrated below %l.start = load %start loop: sel.phi.prom = phi i32 [ %l.start, %ph ], [ %sel.prom, %ph ] %l = load %ptr %sel.prom = select cond, %l, %sel.phi.prom ... exit: use(%sel.prom) This is a first step towards alllowing vectorizing loops using common libc++ library functions, like std::min_element (https://clang.godbolt.org/z/6czGzzqbs) #include <vector> #include <algorithm> int foo(const std::vector<int> &V) { return *std::min_element(V.begin(), V.end()); } Reviewed By: reames Differential Revision: https://reviews.llvm.org/D118143 |
||
---|---|---|
.. | ||
2009-02-17-LoadPRECrash.ll | ||
2009-06-17-InvalidPRE.ll | ||
2011-06-01-NonLocalMemdepMiscompile.ll | ||
2017-06-28-pre-load-dbgloc.ll | ||
2017-10-16-LoadPRECrash.ll | ||
2018-06-08-pre-load-dbgloc-no-null-opt.ll | ||
atomic.ll | ||
invariant-load.ll | ||
load-metadata.ll | ||
load-pre-align.ll | ||
load-pre-licm.ll | ||
load-pre-metadata-accsess-group.ll | ||
load-pre-nonlocal.ll | ||
load-pre-split-backedge.ll | ||
local-pre.ll | ||
lpre-call-wrap-2.ll | ||
lpre-call-wrap.ll | ||
modified-status.ll | ||
nonintegral.ll | ||
phi-translate-2.ll | ||
phi-translate.ll | ||
pre-after-rle.ll | ||
pre-aliasning-path.ll | ||
pre-basic-add.ll | ||
pre-gep-load.ll | ||
pre-jt-add.ll | ||
pre-load-guards.ll | ||
pre-load-implicit-cf-updates.ll | ||
pre-load-in-loop.ll | ||
pre-load-through-select.ll | ||
pre-load.ll | ||
pre-loop-load-new-pm.ll | ||
pre-loop-load-through-select.ll | ||
pre-loop-load.ll | ||
pre-no-cost-phi.ll | ||
pre-poison-add.ll | ||
pre-single-pred.ll | ||
preserve-tbaa.ll | ||
rle-addrspace-cast.ll | ||
rle-phi-translate.ll | ||
rle-semidominated.ll | ||
rle.ll | ||
volatile.ll |