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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 07:45:16 PDT 2024


nikic 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 patch the AssertZExt + CopyFromReg pattern. The AssertZExt could have come from somewhere other than the ABI.

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


More information about the llvm-commits mailing list