[PATCH] Prevent MDNode's RAUW from introducing a reference to a void Value.
Eric Christopher
echristo at gmail.com
Thu Oct 16 18:22:36 PDT 2014
On Thu, Oct 16, 2014 at 6:20 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
>
>> On Oct 16, 2014, at 6:08 PM, Eric Christopher <echristo at gmail.com> wrote:
>>
>> On Thu, Oct 16, 2014 at 6:06 PM, Duncan P. N. Exon Smith
>> <dexonsmith at apple.com> wrote:
>>>
>>>> On Oct 16, 2014, at 3:54 PM, Frederic Riss <friss at apple.com> wrote:
>>>>
>>>> If you look at the added testcase, it cast a void (*func)() to a int (*func)(). The int typed result is referenced in a debug info metadata node (an argument to the dbg.value intrinsic). Then instcombine would remove the bitcast and turn the int returning function into a void returning function that gets RAUWd over the value in the MDNode. And at this point in the current code you have invalid IR.
>>>>
>>>> The code in the testcase is reduced from a huge LTO link that encountered this situation in a much more complicated setup.
>>>>
>>>> http://reviews.llvm.org/D5828
>>>
>>> Weird. This LGTM (after fixing a few super minor whitespace changes);
>>> not sure if Eric is still looking.
>>
>> Enh, I was trying to figure out if there was some way to avoid the
>> void metadata node being create rather than avoiding RAUW'ing it. It's
>> probably not a huge distinction at the moment.
>
> I don't think it is a void metadata node; it's a void `CallInst`.
>
> We have:
>
> call void @llvm.dbg.declare(metadata !{i32* %deadvar}, ...)
> %call = ...
> store i32 %call, i32* %deadvar, align 4, !dbg !21
>
> Which converts to:
>
> call void @llvm.dbg.value(metadata !{i32* %call}, ...)
> %call = ...
>
> Then, when %call gets RAUW'ed, `metadata !{i32* %call}` gets updated
> to `void`.
Aha! That makes way more sense. Thanks!
-eric
More information about the llvm-commits
mailing list