[PATCH] D111161: [UnknownProvenance] Add bitcode support.
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 05:55:43 PDT 2022
jeroen.dobbelaere updated this revision to Diff 440961.
jeroen.dobbelaere added a comment.
Rebased to ffe262a198a9f9030991df6d3ddd812e74fa3523 <https://reviews.llvm.org/rGffe262a198a9f9030991df6d3ddd812e74fa3523>
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
@@ -2511,6 +2511,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
@@ -2872,6 +2872,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.440961.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220629/92a52c3b/attachment.bin>
More information about the llvm-commits
mailing list