[PATCH] D158493: [LAA] Support forked pointer in the form of phi
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 01:07:17 PDT 2023
Allen created this revision.
Allen added reviewers: huntergr, fhahn, david-arm, bsmith, peterwaller-arm, dmgreen.
Herald added subscribers: StephenFan, javed.absar, hiraditya.
Herald added a project: All.
Allen requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.
Given a function like the following: https://godbolt.org/z/T9c99fr88
1161_noReadWrite(int *Preds) {
for (int i = 0; i < LEN_1D-1; ++i) {
if (Preds[i] != 0)
b[i] = c[i] + 1;
else
a[i] = i * i;
}
}
LLVM will optimize the IR to a single store by a phi instruction:
%1 = load ptr, ptr @a, align 64
%2 = load ptr, ptr @b, align 64
...
for.inc:
%.sink = phi ptr [ %1, %if.then ], [ %2, %if.else ]
%add.sink = phi double [ %add, %if.then ], [ %conv8, %if.else ]
%arrayidx7 = getelementptr inbounds double, ptr %.sink, i64 %indvars.iv
store double %add.sink, ptr %arrayidx7, align 8
LAA is currently unable to analyze such IR, since ScalarEvolution
will return a SCEVUnknown for the forked pointer operand of the store.
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, depand on D108699 <https://reviews.llvm.org/D108699>
Fixes https://github.com/llvm/llvm-project/issues/64888
https://reviews.llvm.org/D158493
Files:
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/test/Transforms/LoopVectorize/forked-pointers.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158493.552250.patch
Type: text/x-patch
Size: 22783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230822/9a82283f/attachment.bin>
More information about the llvm-commits
mailing list