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

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 06:50:58 PDT 2016


spatel added inline comments.

================
Comment at: lib/IR/Verifier.cpp:3872-3878
@@ -3871,2 +3871,9 @@
 
+  if (auto *II = dyn_cast<IntrinsicInst>(IF))
+    for (unsigned OpIdx = 0; OpIdx < CS.getNumArgOperands(); ++OpIdx) {
+      auto MaybeReason = II->mustOperandBeConstant(OpIdx);
+      if (MaybeReason != None)
+        Assert(isa<ConstantInt>(CS.getArgOperand(OpIdx)), MaybeReason.getValue());
+    }
+  
   switch (ID) {
----------------
Now that we have a function dedicated to verifying the constant params, shouldn't the corresponding checks in the switch below this be removed?

Either way, I think we have 2 patches in 1 at this point, so it should be split when committing into:
1. Add IntrinsicInst::mustOperandBeConstant()
2. Add Instruction::mustOperandBeConstant()


Repository:
  rL LLVM

https://reviews.llvm.org/D23798





More information about the llvm-commits mailing list