[PATCH] D30826: [DAG] vector div/rem with any zero element in divisor is undef

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 11:26:57 PST 2017


efriedma added a comment.

I agree it's weird that there are two functions for constant folding... but you can leave it for now, I guess.

Maybe check for null or undef, rather than just null?



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3802
+       Opcode == ISD::SREM || Opcode == ISD::UREM) &&
+      any_of(Ops[1]->op_values(), isNullConstant))
+    return getUNDEF(VT);
----------------
I think Ops[1] must be a BUILD_VECTOR here, but it isn't obvious from the structure of the code.  Maybe explicitly cast<> it to BuildVectorSDNode?


https://reviews.llvm.org/D30826





More information about the llvm-commits mailing list