[llvm] [RegAlloc] Account for use availability when applying rematerializable weight discount (PR #159180)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 10:50:49 PDT 2025
================
@@ -124,6 +124,17 @@ bool VirtRegAuxInfo::isRematerializable(const LiveInterval &LI,
if (!TII.isTriviallyReMaterializable(*MI))
return false;
+
+ // If MI has register uses, it will only be rematerializable if its uses are
----------------
preames wrote:
Oh, there's a deeper issue too. The live interval can have multiple definitions, but each use of the register is only going to consume one of them. As currently written, you have each use being compared against def, and as a result, any multi-def live intervals will fail by construction.
I think what you want here instead is to track whether any defs require virt reg uses, and then for the uses of the register which read that def, check that the other live values are live.
Though, since this is an heuristic, maybe only do the deeper check for single def registers? I think that would probably cover most of what you care about.
https://github.com/llvm/llvm-project/pull/159180
More information about the llvm-commits
mailing list