[PATCH] D111633: [SelectionDAG] Fix getVectorSubVecPointer for scalable subvectors.
Paul Walker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 10:15:15 PDT 2021
paulwalker-arm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7822-7824
+ assert(IdxC->getZExtValue() + NumSubElts <= NElts &&
+ "Expected the trivial case to have been handled");
+ return Idx;
----------------
Given you're not making assumptions as to where `Idx` is coming from I don't think an assert is safe enough. Sure an asserts build will exit here but a release build could leak/corrupt data, which is a problem the user is trying to prevent, hence calling this function.
Instead I think the assert should be replaced by always clamping `Idx` (see the `MaxIndex` calculation below). If the source of `Idx` is indeed an `EXTRACT_SUBVECTOR/INSERT_SUBVECTOR` then the invalid index should be asserting as part of `getNode` rather than getting this far.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111633/new/
https://reviews.llvm.org/D111633
More information about the llvm-commits
mailing list