[llvm-dev] how LLVM deals with 'undef'

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 25 12:16:40 PDT 2015


On 8/25/2015 2:09 PM, Xiangyang Guo via llvm-dev wrote:
>
> I'm using LLVM-3.8 (current SVN version) to optimize my code. After loop
> unrolling, I find there is 'undef' in the IR. For example,
> "/%.lcssa21.unr = phi double [ undef, %.lr.ph9 ], [ %13, %7 ]/". I have
> two questions:
>
> (1) Why this 'undef' is generated?  Because before 'loop unrolling',
> there is no such 'undef'.

Most likely to satisfy the syntax of a phi node.  If everything is 
correct, that value will never be used.  If things weren't exactly 
correct, this may be a result of a load from an uninitialized memory, or 
something like that.

> (2) How LLVM backend deals with this 'undef'?

In general, undef will propagate itself through instructions.  How it 
will deal with this specific one, it's impossible to say without the 
context.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-dev mailing list