[llvm] [RegAllocFast] fold foldable inline asm (PR #74344)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 10:37:32 PST 2023
MatzeB wrote:
> Is that something you'd imagine occurring within fastregalloc?
> This PR essentially is a 2 pass algorithm; it does one pass for foldable operands first, then defers to existing machinery for the non-foldable operands. It's not clear from your suggestion of doing that in the opposite order what the improvement would be (if it's even feasible); can you provide more thoughts on what you have in mind?
Yes I was referring to the loop prefixed with `// Allocate virtreg uses and insert reloads as necessary.` and was wondering if we could replace this with something like this pseudo code:
```
// Allocate virtreg uses and insert reloads as necessary.
if (isInlineAsm(MI)) {
assignInlineAsmUses(MI...);
} else {
... original loop to assign uses ...
}
...
void assignInlineAsmUses(MI) {
// We do two passes to assign the non-foldable operands first, as they require an assigned physical register while
// foldable operands can always be spilled if there are no registers left.
// first pass for non-foldable operands
... original loop to assign uses, but with added `if (isFoldableMemOp(MO)) continue;` ...
// 2nd pass for foldable operands
... original loop to assign uses, but with added `if (!isFoldableMemOp(MO)) continue;` ...
}
```
https://github.com/llvm/llvm-project/pull/74344
More information about the llvm-commits
mailing list