[LLVMdev] Proposal to Remove Poison

Sanjoy Das sanjoy at playingwithpointers.com
Tue Feb 17 09:46:37 PST 2015


>  Sanjoy proposed in another email to make undef an instruction. That would actually solve this problem. SROA could replace the load with an undef instruction, forcing %and to be true. Undef instructions could be determinized to 0 in codegen (if not removed beforehand).

Undef-as-an-instruction has a problem when combined with "loads from
uninitialized memory are undef".  If by "loads from uninitialized
memory are undef" we mean the old "undef" then we have the same
problem of "xor %x, %x" not always being zero.  And if by "loads from
uninitialized memory are undef" we mean "the load is equivalent to an
gen_undef instruction" then we cannot duplicate loads unless we know
that the load is from initialized memory since

%x = load P
%y = xor %x, %x

is not the same as

%x0 = load P
%x1 = load P
%y = xor %x0, %x1

for an uninitialized *P

-- Sanjoy

>
> The downsize of having just one type of undef is that then all undefs are the same in the following sense:
> %mem = alloca
> %load = load %mem
> %cmp = icmp slt %load, INT_MIN
>
> With current LLVM, %cmp will always be false. With your proposal, %cmp will be undef, and therefore potentially true, which is strange.
>
>
> Nuno
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list