[llvm] [IR] Allow type change in ValueAsMetadata::handleRAUW (PR #76969)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 07:23:49 PST 2024


SLTozer wrote:

Agreed with this being harmless - not all cases of `ValueAsMetadata::handleRAUW` pass through `Value::doRAUW`, and by the sounds of it this isn't happening in a typical RAUW case? I don't think there's any context where changing the type of a VAM in a debug info context would cause an error; though if your case only involves poison types, it might be safer to change the assert to:
`assert((isa<PoisonValue>(To->getType()) || From->getType() == To->getType()) && "Expected same or poison type");`
This wouldn't weaken the existing guarantees very much, while enabling your use case if I understand correctly - if it's necessary or more convenient to use the existing approach though then I have no objections, though as above adding a motivating test case would be good.

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


More information about the llvm-commits mailing list