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

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 08:00:13 PDT 2024


bjope 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.

We had that earlier attempt that classified AssertZext/AssertSext as not producing poison. It was reverted due to AssertSext being used in some fptosi legalization (see #66603). So yes, we need to consider that as well somehow.

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


More information about the llvm-commits mailing list