[PATCH] D86074: [ARM][MVE] Tail-predication: check get.active.lane.mask's BTC value
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 09:03:31 PDT 2020
SjoerdMeijer added inline comments.
================
Comment at: llvm/lib/Target/ARM/MVETailPredication.cpp:405
+ LLVM_DEBUG(dbgs() << "ARM TP: BTC found in the preheader block: "
+ << *DefBTC << "\n");
+ } else {
----------------
I probably forgot to state what I didn't do here.
Here, at this place, we could add more checks and cross reference the BTC obtained after IR pattern matching with the BTC that SCEV can calculate. For example, if we find a`%BTC = add %N, -1` for the get.active.lane intrinsic, then we could take the variable `%N` and see if that is used in the backedge taken count expression that SCEV can calculate for this loop. If we find `%N` as an operand in both expressions, we know both expressions are bound by the same variable, which is a good check to have. However, for the simple cases this is pretty simple, but as soon as we have a SCEV RecAddexpr, things get more complicated pretty fast. For example, if the pattern matched BTC instruction is described with:
{(-1 + (sext i16 %N to i32)),+,-1}<nw><%for.body>
and the BTC of the vectorised loop with a factor of 4 with:
((-4 + (4 * ({(3 + (sext i16 %N to i32))<nsw>,+,-1}<%for.body> /u 4))<nuw>) /u 4)
Then extracting `%N` from both of these expressions and comparing this involves writing a mini scev visitor which I am a bit reluctant to do, may not be so generic, and I was hoping that the checks already performed are good enough smoke tests....
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86074/new/
https://reviews.llvm.org/D86074
More information about the llvm-commits
mailing list