[PATCH] D18305: [InstCombine] Ensure all undef operands are handled before binary instruction constant folding

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 20 14:28:05 PDT 2016

majnemer added inline comments.

Comment at: lib/IR/ConstantFold.cpp:1001-1003
@@ -1000,2 +1000,5 @@
       return Constant::getNullValue(C1->getType());
+    default:
+      // We don't know how to handle UNDEFs in this instruction.
+      return nullptr;
I don't like this because it will silently accept newly added binary operators.
I'd instead prefer if the switch was over the Opcode static_cast'd to the `BinaryOps` type (perhaps with an assertion that `isBinaryOp(Opcode)`).



More information about the llvm-commits mailing list