[LLVMdev] ConstantFold 'undef xor undef'

Chris Lattner clattner at apple.com
Wed Jul 7 08:38:12 PDT 2010


On Jul 7, 2010, at 5:47 AM, Jianzhou Zhao wrote:

>> 
>> Does this also apply to two different variables? say
>>   int z x y;
>>   z = x ^ y;
>> If ConstantFoldBinaryInstruction also folds x ^ y into z, should this
>> pass (which uses ConstantFold) also initialize x and y with a same
>> initial value? Otherwise at runtime z may not be 0.
> 
> I guess my question is what variables can have undef values. In my
> understanding, only uninitialized locals and globals can be undefined,
> so compilers are free to assign them at runtime, if
> ConstantFoldBinaryInstruction ensures that x and y can only be locals
> and globals. But function parameters cannot be undefined, which should
> be arbitrary symbols, depending on concrete arguments. Is this
> correct?

I don't really understand your question here.  Are you asking about C or LLVM IR, or something else?

-Chris



More information about the llvm-dev mailing list