[PATCH] D23798: [Instruction] Introduce a predicate mustOperandBeConstant()

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 08:04:02 PDT 2016


jmolloy added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1383-1385
@@ -1382,5 @@
-                                          unsigned OpIdx) {
-  // Early exit.
-  if (!isa<Constant>(I->getOperand(OpIdx)))
-    return true;
-
----------------
spatel wrote:
> Is this check removed intentionally? Ie, we must assume that the instruction may be malformed?
I removed it because I felt that having the predicate in Instruction provide possibly different results based on the current operands would be confusing to debug.

Thinking about it though, having a predicate say "this operand must be constant" when it is currently a variable (because the predicate is being conservative) probably isn't ideal.

I'm conflicted about the right way to go here.


Repository:
  rL LLVM

https://reviews.llvm.org/D23798





More information about the llvm-commits mailing list