[llvm-dev] Canonical way to handle zero registers?

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 27 14:00:17 PST 2017



> On Dec 26, 2017, at 18:42, Sean Silva via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Thanks! That looks like a winning approach.
> 
> I swear I grepped around for ISD::Constant but for some reason never found this code. I think maybe I was searching for ISD::Constant with setOperationAction, which in hindsight was narrowing down my search to just lowering, which is exactly what I didn't want! (I was looking for other approaches). I also tried looking in depth at PowerPC but it looks like it doesn't use this approach either.
> 
> -- Sean Silva

What’s the reason for trying to handle this in SelectionDAG at all? I would just materialize zero like any other constant, and treat replacing that with the zero register as an immediate folding optimization (e.g. FoldImmediate or another peephole pass)

-Matt


More information about the llvm-dev mailing list