[PATCH] D122690: [VP] Add verifier check that arguments vp_fptosi and vp_sitofp FP/int types.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 15:36:08 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: frasercrmck, rogfer01, simoll, loralb.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

Intrinsics.td only says they need be vectors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122690

Files:
  llvm/lib/IR/Verifier.cpp


Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -5601,6 +5601,25 @@
            "equal",
            *VPCast);
   }
+
+  switch (VPI.getIntrinsicID()) {
+  case Intrinsic::vp_fptosi: {
+    Value *Operand = VPI.getArgOperand(0);
+    Assert(Operand->getType()->isFPOrFPVectorTy(),
+           "Intrinsic first argument must be floating point", &VPI);
+    Assert(VPI.getType()->isIntOrIntVectorTy(),
+           "Intrinsic result must be an integer", &VPI);
+    break;
+  }
+  case Intrinsic::vp_sitofp: {
+    Value *Operand = VPI.getArgOperand(0);
+    Assert(Operand->getType()->isIntOrIntVectorTy(),
+           "Intrinsic first argument must be an integer", &VPI);
+    Assert(VPI.getType()->isFPOrFPVectorTy(),
+           "Intrinsic result must be floating point", &VPI);
+    break;
+  }
+  }
 }
 
 void Verifier::visitConstrainedFPIntrinsic(ConstrainedFPIntrinsic &FPI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122690.419002.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220329/8dd871cc/attachment.bin>


More information about the llvm-commits mailing list