[llvm] [MachineLICM] Give opportunity to analyze physregs for invariance. (PR #84779)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 13:59:16 PDT 2024


sdesmalen-arm wrote:

> > > This looks reasonable, but isn't it the same as `isIgnorableUse`? Or do you need this because you want hoisting but still want to prevent rematerialization?
> > 
> > 
> > Yes, the latter. We've added the implicit def/use of these registers to prevent rematerialization from occurring.
> 
> Is it the same as adding code to ignore $vg to the `isIgnorableUse` instead and then override `isTriviallyReMaterializable` to check for $vg imp-use and return false?

Unless I misunderstand what you're suggesting, I believe it is not the same because  `implicit $vg` cannot be ignored. The dependence on `$vg` is important when trying to determine whether the instruction can be hoisted. Any definition of it in the loop should stop hoisting from happening. In contrast, `isIgnorableUse` does not result in any check for loop invariance of a physical register, it would instead just ignore the implicit use and continue the analysis as if it never saw the implicit use.

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


More information about the llvm-commits mailing list