[PATCH] D111161: [UnknownProvenance] Add bitcode support.
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 08:08:14 PDT 2021
jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: jdoerfert, nikic.
Herald added a subscriber: hiraditya.
jeroen.dobbelaere requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add bitcode support for `UnknownProvenance`.
https://reviews.llvm.org/D111161
Files:
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -2486,6 +2486,8 @@
Code = bitc::CST_CODE_POISON;
} else if (isa<UndefValue>(C)) {
Code = bitc::CST_CODE_UNDEF;
+ } else if (isa<UnknownProvenance>(C)) {
+ Code = bitc::CST_CODE_UNKNOWN_PROVENANCE;
} else if (const ConstantInt *IV = dyn_cast<ConstantInt>(C)) {
if (IV->getBitWidth() <= 64) {
uint64_t V = IV->getSExtValue();
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2447,6 +2447,11 @@
case bitc::CST_CODE_UNDEF: // UNDEF
V = UndefValue::get(CurTy);
break;
+ case bitc::CST_CODE_UNKNOWN_PROVENANCE: // UNKNOWN_PROVENANCE
+ if (!CurTy->isPointerTy())
+ return error("Invalid type for a unknown_provenance");
+ V = UnknownProvenance::get(cast<PointerType>(CurTy));
+ break;
case bitc::CST_CODE_POISON: // POISON
V = PoisonValue::get(CurTy);
break;
Index: llvm/include/llvm/Bitcode/LLVMBitCodes.h
===================================================================
--- llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -384,6 +384,7 @@
CST_CODE_INLINEASM = 28, // INLINEASM: [sideeffect|alignstack|
// asmdialect|unwind,
// asmstr,conststr]
+ CST_CODE_UNKNOWN_PROVENANCE = 29, // UNKNOWN_PROVENANCE
};
/// CastOpcodes - These are values used in the bitcode files to encode which
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111161.377255.patch
Type: text/x-patch
Size: 1815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/dbf73a73/attachment.bin>
More information about the llvm-commits
mailing list