[PATCH] D123414: [AArch64] Break up larger shuffle-masks into legal sizes in getShuffleCost

Sam Tebbs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 06:50:02 PDT 2022


samtebbs added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:2654
+          NumSources = 1;
+        } else if (NumSources == 1 && Source != Source1) {
+          Source2 = Source;
----------------
dmgreen wrote:
> samtebbs wrote:
> > I might be misunderstanding this part of the code but I don't see how `Source != Source1` will ever be true, since `Source1` is assigned to `Source` when `NumSources == 0`, which is always the case in the first iteration. Same for the other else-if below.
> The first unique Sources we find will get into the first `if (NumSources == 0)`. The next time we find a `Source` that isn't `== Source1` we will get into this if, and if we find more than 2 unique `Sources`, we just start to accumulate the total number of sources. If the Source is already one of `Source1` or `Source2` then we have already counted it and don't need to process. it in these checks again. Because `NumSources` increases it is kind of like a state machine.
I think I somehow missed the assignment to `Source` when I looked over it the first time. Thanks for the explanation.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123414/new/

https://reviews.llvm.org/D123414



More information about the llvm-commits mailing list