[PATCH] D113351: [DAG] Add BuildVectorSDNode::getConstantRawBits helper
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 7 01:58:04 PDT 2021
RKSimon planned changes to this revision.
RKSimon added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:10932-10933
+
+ if (!isConstant())
+ return false;
+
----------------
pengfei wrote:
> Move ahead?
Yes I can do that - the BuildVectorSDNode methods are inconsistent as to whether the output variables are canonicalized or not on failure.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:10942
+ for (unsigned J = 0; J != Scale; ++J) {
+ SDValue Op = getOperand((I * Scale) + (IsLE ? J : (Scale - J - 1)));
+ if (Op.isUndef())
----------------
pengfei wrote:
> Do we need to check `IsLE` for `I`?
Not AFAICT - we don't do that for other vectors-through-bitcasts (the DAG code this was pulled out of, shuffles-of-bitcasts, etc.) - its purely the elements that alias within the bitcast that need swapping..
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:10951
+ CInt ? CInt->getAPIntValue().zextOrTrunc(SrcEltSizeInBits)
+ : CFP->getValueAPF().bitcastToAPInt(),
+ J * SrcEltSizeInBits);
----------------
pengfei wrote:
> Do we need to `zextOrTrunc` it?
For integer - a truncOrSelf would suffice. For float the bitwidths should match. I'll add an assert to be sure.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113351/new/
https://reviews.llvm.org/D113351
More information about the llvm-commits
mailing list