[PATCH] D108699: [LAA] Analyze pointers forked by a select
Graham Hunter via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 25 06:04:22 PDT 2021
huntergr created this revision.
huntergr added reviewers: fhahn, sdesmalen, reames, eli.friedman, david-arm.
Herald added subscribers: javed.absar, hiraditya.
huntergr requested review of this revision.
Herald added a project: LLVM.
Given a function like the following:
void forked_ptrs_different_base_same_offset(float *Base1, float *Base2, float *Dest, int *Preds) {
for (int i=0; i<100; i++) {
if (Pred[i] != 0) {
Dest[i] = Base1[i];
} else {
Dest[i] = Base2[i];
}
}
}
LLVM will optimize the IR to a single load using a pointer determined by a select instruction:
%spec.select = select i1 %cmp1.not, float* %Base2, float* %Base1
%.sink.in = getelementptr inbounds float, float* %spec.select, i64 %indvars.iv
%.sink = load float, float* %.sink.in, align 4
LAA is currently unable to analyze such IR, since ScalarEvolution will return a SCEVUnknown for the pointer operand for the load.
This patch adds initial optional support for analyzing both possibilities for the pointer and allowing LAA to generate runtime checks for the bounds if required.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108699
Files:
llvm/include/llvm/Analysis/LoopAccessAnalysis.h
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Transforms/LoopVectorize/forked-pointers.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108699.368619.patch
Type: text/x-patch
Size: 44429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210825/0bad6683/attachment.bin>
More information about the llvm-commits
mailing list