[PATCH] D138883: [PowerPC] find and reuse ConstantSplatVector to combine constant store into extract and store
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 06:47:36 PST 2023
nemanjai added a comment.
Sorry, I had unsubmitted comments. Not sure if they still apply.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14886
+// findAndReuseSplatForConst - Search for opportunity that store constant int/fp
+// shares the same chain with another store constant vector, which is a splat of
----------------
Nit: you don't need the name of the function here.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14900
+
+ APInt ConstVal = dyn_cast<ConstantSDNode>(N->getOperand(1))->getAPIntValue();
+ auto StoreSizeInBits = ST->getMemoryVT().getSizeInBits();
----------------
What if `dyn_cast` returns `null` (i.e. if operand 1 is not a constant)?
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14909-14911
+ APInt BitWidth(8, StoreSizeInBits);
+ if (!BitWidth.isPowerOf2())
+ return SDValue();
----------------
We don't need to construct an `APInt` just to check whether it is a power of 2. You can just use `isPowerOf2_64()` from `MathExtras.h`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138883/new/
https://reviews.llvm.org/D138883
More information about the llvm-commits
mailing list