[LLVMdev] Assert on Large Zeroinitializer Store

John Criswell criswell at illinois.edu
Wed Aug 24 12:07:11 PDT 2011


On 8/24/11 1:51 PM, Eli Friedman wrote:
> On Wed, Aug 24, 2011 at 11:41 AM, John Criswell<criswell at illinois.edu>  wrote:
>> Dear All,
>>
>> I currently have one of my transforms creating the following store
>> instruction:
>>
>> store [65536 x i8] zeroinitializer, [65536 x i8]* %buf.i, align 16
>>
>> ... which causes the SelectionDAG code to assert out:
>>
>> Assertion failed: (ResNo<  NumValues&&  "Illegal result number!"),
>> function getValueType, file
>> /Users/criswell/src/llvm/include/llvm/CodeGen/SelectionDAGNodes.h, line 589.
>>
>> Should LLVM be able to code generate the above store instruction?  If
>> not, how large a value can a store instruction store to memory without
>> triggering problems in the code generator?
> I don't know the exact limit, but if you're storing an array or struct
> with more that 10 elements with a store instruction, you're doing
> something wrong.

Okay.

I can certainly use memset (I'm just zero'ing out memory by storing a 
zeroinitializer).  Using stores just looked a little cleaner to me.

Is there a reason why storing a zeroinitializer of such large size is 
considered "wrong?"  It seems like it wouldn't generate any performance 
hit if the code generator took care of it properly.

-- John T.


>    Use memcpy and/or memset instead.
>
> -Eli




More information about the llvm-dev mailing list