[llvm-dev] imm COPY generated by PHI elim not propagated

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 13 07:36:03 PST 2019

I have some code such that:

vgpr1 = mov 0
branch bb
PHI vgpr2 = vgpr1, ….
PHI vgpr3 = vgpr1, ….
PHI vgpr4 = vgpr1, ….
PHI vgpr5 = vgpr1, ….

PHI node elimination is generating copies for all these PHIs (and hoisting
them) as such:

vgpr1 = 0
vgpr20 = COPY vgpr1 // old vgpr2
vgpr30 = COPY vgpr1 // old vgpr3
vgpr40 = COPY vgpr1 // old vgpr4
vgpr 50 = COPY vgprt1 // old vgpr5

I expect the zero to get propagated in a later phase but it's not. I was
looking at adding immediate folding to the register coalescer but this
doesn't really seem like the right place. Any suggestions?

I'm sort of surprised that other targets haven't run into this issue.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191113/a3e7309a/attachment.html>

More information about the llvm-dev mailing list