[PATCH] D158115: [SelectionDAG][RISCV][SVE] Harden fixed offset version of ComputeValueVTs against scalable offsets.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 13:41:24 PDT 2023
craig.topper created this revision.
craig.topper added reviewers: paulwalker-arm, efriedma, sdesmalen, eopXD, kmclaughlin.
Herald added subscribers: jobnoorman, VincentWu, vkmr, luismarques, sameer.abuasal, s.egerton, Jim, psnobl, benna, rogfer01, shiva0217, kito-cheng, simoncook, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: wangpc, alextsao1999.
Herald added a project: LLVM.
Use getFixedValue instead of getKnownMinValue to convert TypeSize
to uint64_t. I believe this would have caught the bug fixed by
D157872 <https://reviews.llvm.org/D157872>.
To prevent false failures, I had to treat a scalable 0 as if it
is fixed value.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158115
Files:
llvm/lib/CodeGen/Analysis.cpp
Index: llvm/lib/CodeGen/Analysis.cpp
===================================================================
--- llvm/lib/CodeGen/Analysis.cpp
+++ llvm/lib/CodeGen/Analysis.cpp
@@ -144,7 +144,10 @@
if (FixedOffsets) {
ComputeValueVTs(TLI, DL, Ty, ValueVTs, &Offsets, Offset);
for (TypeSize Offset : Offsets) {
- FixedOffsets->push_back(Offset.isZero() ? Offset.getKnownMinValue() : Offset.getFixedValue());
+ // Treat scalable zero as if it is fixed. Otherwise use getFixedValued
+ // to get an assert for scalable offsets.
+ FixedOffsets->push_back(Offset.isZero() ? Offset.getKnownMinValue()
+ : Offset.getFixedValue());
}
} else {
ComputeValueVTs(TLI, DL, Ty, ValueVTs, nullptr, Offset);
@@ -170,7 +173,10 @@
if (FixedOffsets) {
ComputeValueVTs(TLI, DL, Ty, ValueVTs, MemVTs, &Offsets, Offset);
for (TypeSize Offset : Offsets) {
- FixedOffsets->push_back(Offset.isZero() ? Offset.getKnownMinValue() : Offset.getFixedValue());
+ // Treat scalable zero as if it is fixed. Otherwise use getFixedValued
+ // to get an assert for scalable offsets.
+ FixedOffsets->push_back(Offset.isZero() ? Offset.getKnownMinValue()
+ : Offset.getFixedValue());
}
} else {
ComputeValueVTs(TLI, DL, Ty, ValueVTs, MemVTs, nullptr, Offset);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158115.550869.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/55951aaa/attachment.bin>
More information about the llvm-commits
mailing list