diff options
author | Florian Hahn <flo@fhahn.com> | 2022-02-02 09:23:09 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2022-02-02 09:23:09 +0000 |
commit | 8a12cae862af3208609127aaf288ab5298d33d38 (patch) | |
tree | a002fe4d587dffdfcffb56502db61bdba5710522 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h | |
parent | dc82547b173ffed79c87e57339540baed096410f (diff) | |
download | llvm-8a12cae862af3208609127aaf288ab5298d33d38.zip llvm-8a12cae862af3208609127aaf288ab5298d33d38.tar.gz llvm-8a12cae862af3208609127aaf288ab5298d33d38.tar.bz2 |
[GVN] Support load of pointer-select to value-select conversion.
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
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h')
0 files changed, 0 insertions, 0 deletions