IR: Add distinct MDNodes as a first-class concept

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jan 8 06:28:03 PST 2015


> Introduce a `distinct` designator which explicitly requests this
> behaviour, without the need for a self-reference.  These nodes are
> still stored in the `LLVMContext`, but are not uniqued based on
> their operands (well, not uniqued at all).
>
>   - This concept *already exists*.  Before the metadata/value split,
>     it was used whenever operands went to null (to prevent teardown
>     madness, but it happened more frequently).  It's still in use
>     for self-referencing `MDNode`s, as well as when
>     `MDNode::replaceOperandWith()` causes a uniquing collision (see
>     module flags behaviour before r225397 for an example).

Side question: this is because of missing rauw on resolved nodes, right?

Could we just disallow replaceOperandWith on resolved nodes and add a
"MDNode *getNodeWithReplacedOperand(unsigned I, Metadata *New)" that
returns a node just like 'this' but with operand I replaced with New?

Cheers,
Rafael



More information about the llvm-commits mailing list