[llvm-dev] [llvm-reduce] Reduction to undef/poison/null?

Nuno Lopes via llvm-dev
Mon, 30 Aug 2021 18:26:49 -0000

What I usually end up doing when reducing by hand is to introduce a new function
parameter to replace a deleted instruction, e.g.:



define @f(i32 %x) {

  %y = add i32 %x, ...

...

}

=>

define @f(i32 %x, i32 %y) {

<remove instr %y>

...

}



Though not all users will want this sort of reduction..



I agree with what other said about undef/poison: avoid them at all costs when
reducing. It will just expose some other bug regarding handling of undef in
optimizers instead of the bug you wanted to track down :)



Nuno





From: Arthur Eubanks via llvm-dev
Sent: 30 August 2021 18:50
To: llvm-dev <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] [llvm-reduce] Reduction to undef/poison/null?



Currently in llvm-reduce when we try to remove instructions, we'll RAUW them
with undef. But it seems nicer to have the final IR use null values (e.g. 0,
zeroinitializer, etc) rather than undef. Should we attempt to use null values?
Or why undef over poison?

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20210830/483a2f03/attachment.html>