[llvm-dev] how LLVM deals with 'undef'
Daniel Berlin via llvm-dev
llvm-dev at lists.llvm.org
Tue Aug 25 12:53:47 PDT 2015
" But I really don't want this 'undef' in IR"
You can't avoid it in IR, it is in fact, part of the IR, and may get
introduced in certain situations.
It's like saying "i don't want add's"
On Tue, Aug 25, 2015 at 12:22 PM, Xiangyang Guo via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Thanks for reply.
> First, I use Clang to compile my source code without any optimization so
> that I get one .bc file, in which there is no 'undef' showing up. Then, I
> use opt to optimize the IR. So I assume things are correct and the 'undef'
> is introduced to satisfy the syntax of phi node, as you mentioned. But I
> really don't want this 'undef' in IR. Do you have any idea to get rid of
> 'undef'? Thanks a lot.
> On Tue, Aug 25, 2015 at 3:16 PM, Krzysztof Parzyszek via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> 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.
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
>> by The Linux Foundation
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
More information about the llvm-dev