[PATCH] IR: Make the X / undef -> undef fold match the comment

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 16:46:55 PST 2016

The constant folding for sdiv and udiv has a big discrepancy between the
comments and the code, which looks like a typo. Currently, we're folding
X / undef pretty inconsistently:

  0 / undef -> undef
  C / undef -> 0
  undef / undef -> 0

Whereas the comments state we do X / undef -> undef. The logic that
returns zero is actually commented as doing undef / X -> 0, despite that
the LHS isn't undef in many of the cases that hit it.

Is this okay to commit, or is it the comments that should be updated to
match the code instead?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: undef-div.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160224/940a9596/attachment.bin>

More information about the llvm-commits mailing list