[llvm] [AMDGPU] Prevent hang in SIFoldOperands (PR #82099)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 12:07:53 PST 2024


================
@@ -774,21 +774,25 @@ void SIFoldOperands::foldOperand(
   if (UseMI->isRegSequence()) {
     Register RegSeqDstReg = UseMI->getOperand(0).getReg();
     unsigned RegSeqDstSubReg = UseMI->getOperand(UseOpIdx + 1).getImm();
-
-    for (auto &RSUse : make_early_inc_range(MRI->use_nodbg_operands(RegSeqDstReg))) {
-      MachineInstr *RSUseMI = RSUse.getParent();
+    
+    // Grab the use operands first
+    SmallVector<MachineOperand *, 4> UsesToProcess;
+    for (auto &Use : MRI->use_nodbg_operands(RegSeqDstReg)) {
----------------
jayfoad wrote:

Nit: don't need braces around a single physical line.

https://github.com/llvm/llvm-project/pull/82099


More information about the llvm-commits mailing list