[PATCH] D104043: [IR] Value: Fix OpCode checks
Sami Tolvanen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 10 12:10:17 PDT 2021
samitolvanen updated this revision to Diff 351233.
samitolvanen added a comment.
Changed the message to refer to CallBase instead of CallInst.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104043/new/
https://reviews.llvm.org/D104043
Files:
llvm/lib/IR/Value.cpp
Index: llvm/lib/IR/Value.cpp
===================================================================
--- llvm/lib/IR/Value.cpp
+++ llvm/lib/IR/Value.cpp
@@ -58,10 +58,13 @@
// FIXME: Why isn't this in the subclass gunk??
// Note, we cannot call isa<CallInst> before the CallInst has been
// constructed.
- if (SubclassID == Instruction::Call || SubclassID == Instruction::Invoke ||
- SubclassID == Instruction::CallBr)
+ unsigned OpCode = 0;
+ if (SubclassID >= InstructionVal)
+ OpCode = SubclassID - InstructionVal;
+ if (OpCode == Instruction::Call || OpCode == Instruction::Invoke ||
+ OpCode == Instruction::CallBr)
assert((VTy->isFirstClassType() || VTy->isVoidTy() || VTy->isStructTy()) &&
- "invalid CallInst type!");
+ "invalid CallBase type!");
else if (SubclassID != BasicBlockVal &&
(/*SubclassID < ConstantFirstVal ||*/ SubclassID > ConstantLastVal))
assert((VTy->isFirstClassType() || VTy->isVoidTy()) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104043.351233.patch
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/7bb884ad/attachment.bin>
More information about the llvm-commits
mailing list