From db9057edca0fe14987fb892f52bc51441316892c Mon Sep 17 00:00:00 2001 From: Pengcheng Wang Date: Thu, 5 Dec 2024 20:14:58 +0800 Subject: [Sched] Skip MemOp with unknown size when clustering (#118443) In #83875, we changed the type of `Width` to `LocationSize`. To get the clsuter bytes, we use `LocationSize::getValue()` to calculate the value. But when `Width` is an unknown size `LocationSize`, an assertion "Getting value from an unknown LocationSize!" will be triggered. This patch simply skips MemOp with unknown size to fix this issue and keep the logic the same as before. This issue was found when implementing software pipeliner for RISC-V in #117546. The pipeliner may clone some memory operations with `BeforeOrAfterPointer` size. --- llvm/lib/CodeGen/MachineScheduler.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp') diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index 23e5e4a..7da9b3a 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -1947,6 +1947,9 @@ void BaseMemOpClusterMutation::collectMemOpRecords( LocationSize Width = 0; if (TII->getMemOperandsWithOffsetWidth(MI, BaseOps, Offset, OffsetIsScalable, Width, TRI)) { + if (!Width.hasValue()) + continue; + MemOpRecords.push_back( MemOpInfo(&SU, BaseOps, Offset, OffsetIsScalable, Width)); -- cgit v1.1