Arthur Eubanks via llvm-dev
2021-Aug-30 17:50 UTC
[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/b7a068f5/attachment.html>
David Blaikie via llvm-dev
2021-Aug-30 17:59 UTC
[llvm-dev] [llvm-reduce] Reduction to undef/poison/null?
Nicer because it's less likely to introduce new UB? Or some other reason? I /guess/ undef because it's more vague/shows the value doesn't matter to some degree? (might be worth CC'ing some of the other folks who've contributed patches/implemented llvm-reduce - not everyone reads llvm-dev or does so frequently enough to see relevant threads in a timely manner) On Mon, Aug 30, 2021 at 10:50 AM Arthur Eubanks via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210830/8c786374/attachment.html>
Nuno Lopes via llvm-dev
2021-Aug-30 18:26 UTC
[llvm-dev] [llvm-reduce] Reduction to undef/poison/null?
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>