[clang] [llvm] [clang-tools-extra] [MCP] Enhance MCP copy Instruction removal for special case (PR #70778)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 07:41:29 PST 2023


LWenH wrote:

> > Shouldn't we forget about L1 when we get to L2?
> 
> I agree with we should forget about L1 when we get to L2. The semantic of `Copies[Unit].DefRegs` should be Registers defined by `Unit` in COPY instructions, we want to keep this invariant during tracking. I think it's appropriate to keep this property during `trackCopy`. After L2, `Copies[<r9's units>].DefRegs` still containing `r0` is violating this property.

Address @qcolombet and @bzEq 's comments,  after more carefully reconsideration, I think we could always do this DefRegs record elimination when we inivoke the **clobberRegister** routine.  

When we clobber a single register(Def), the semantic of Src's **DefRegs** to contain Def is no longer effectual, because the **DefRegs** is always used in **findCopyDefViaUnit**  during the **BackwardCopyPropagateBlock** function.  After we clobbering a single register, the Src is no longer propagatable either. In other word, we don't need to keep this record in the tracker after we clobbering a **Def** register.



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


More information about the cfe-commits mailing list