[llvm] [AMDGPU] Prevent cyclic behaviour in SIFoldOperands (PR #82099)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 18 23:42:48 PST 2024
================
@@ -772,7 +773,7 @@ void SIFoldOperands::foldOperand(
if (UseMI->isRegSequence()) {
Register RegSeqDstReg = UseMI->getOperand(0).getReg();
unsigned RegSeqDstSubReg = UseMI->getOperand(UseOpIdx + 1).getImm();
-
+ static std::unordered_set<MachineInstr *> seenMI;
----------------
Pierre-vh wrote:
Use a `DenseSet` instead (better for pointers) and `CamelCase` in var name
Also don't use a static var for this, use something you pass as argument and that's reset/recreated for every function, or use some field in the pass. You can even make the field `mutable` to avoid removing `const`
https://github.com/llvm/llvm-project/pull/82099
More information about the llvm-commits
mailing list