[PATCH] D15798: Fix for Bug 24852 (crash with -debug -instcombine)

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 14:47:37 PST 2016


> On 2016-Jan-06, at 14:45, Xinliang David Li <davidxl at google.com> wrote:
> 
> On Wed, Jan 6, 2016 at 2:44 PM, Than McIntosh <thanm at google.com> wrote:
>> thanm added a comment.
>> 
>>> This test case is quite large, can it be made smaller?
>> 
>> 
>> Most of the size is from the "-g" metadata, however the crash does not happen without metadata (in particular, compiling without "-g" makes the problem go away).  I could try to edit the metadata by hand -- are there any guidelines or suggestions you could offer with that regard?
>> 
>>> Also there are no changes to InstCombine, why are you running the pass?
>> 
>> 
>> The test is intended to make sure that you can run instcombine with "-debug" and not crash.
>> 
>> @joker.eph: I agree with your assessment.
>> 
>> 
>> ================
>> Comment at: lib/IR/AsmWriter.cpp:3157
>> @@ -3156,3 +3156,3 @@
>>     Out << Separator;
>> -    if (Kind < MDNames.size()) {
>> +    if (TheModule && Kind < MDNames.size()) {
>>       Out << "!";
>> ----------------
>> joker.eph wrote:
>>> Why do you need `TheModule` here?
>> TheModule is a null pointer in the case where the instruction has no parent BB.
> 
> This sounds like an invalid IR state ..

Even so, the AsmWriter should print without crashing even with the IR is
in a bad state.

> David
> 
>> 
>> 
>> http://reviews.llvm.org/D15798
>> 
>> 
>> 



More information about the llvm-commits mailing list