[llvm] [SelectionDAG] Treat CopyFromReg as freezing the value (PR #85932)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 02:43:18 PDT 2024


arsenm wrote:

> > A common pattern is that there is an AssertZext or AssertSext just
> > after CopyFromReg. I think that if we treat CopyFromReg as never
> > being poison, then it should be allowed to fold
> > (freeze(AssertZext(CopyFromReg))) -> AssertZext(CopyFromReg))
> 
> If we say that violating a zeroext/signext attribute is undefined behavior rather than producing a poison value, then yes -- with the caveat that we can't just match the AssertZExt + CopyFromReg pattern. The AssertZExt could have come from somewhere other than the ABI.

This would kind of render AssertSext/AssertZext useless

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


More information about the llvm-commits mailing list