[PATCH] D111161: [UnknownProvenance] Add bitcode support.
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 06:58:05 PDT 2022
jeroen.dobbelaere updated this revision to Diff 423092.
jeroen.dobbelaere added a comment.
Herald added a project: All.
Rebase to 49cb4fef02e635bf304906232214166c7531d753 <https://reviews.llvm.org/rG49cb4fef02e635bf304906232214166c7531d753>
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111161/new/
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
@@ -2491,6 +2491,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
@@ -2582,6 +2582,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
@@ -392,6 +392,7 @@
// sideeffect|alignstack|
// asmdialect|unwind,
// asmstr,conststr]
+ CST_CODE_UNKNOWN_PROVENANCE = 31, // UNKNOWN_PROVENANCE
};
/// CastOpcodes - These are values used in the bitcode files to encode which
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111161.423092.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220415/c9097b96/attachment.bin>
More information about the llvm-commits
mailing list