Summary:
This patch resolves llvm-c-test's following error
```
LLVM ERROR: LLVMGetValueKind returned incorrect type
```
which arises when the input bitcode contains a null pointer.
Reviewers: jdoerfert, CodaFi, deadalnix
Reviewed By: jdoerfert
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68928
@protected = protected global i32 23
@section = global i32 27, section ".custom"
@align = global i32 31, align 4
+@nullptr = global i32* null
@aliased1 = alias i32, i32* @var
@aliased2 = internal alias i32, i32* @var
EltCount, LLVMIsPackedStruct(Ty));
}
+ // Try ConstantPointerNull
+ if (LLVMIsAConstantPointerNull(Cst)) {
+ check_value_kind(Cst, LLVMConstantPointerNullValueKind);
+ LLVMTypeRef Ty = TypeCloner(M).Clone(Cst);
+ return LLVMConstNull(Ty);
+ }
+
// Try undef
if (LLVMIsUndef(Cst)) {
check_value_kind(Cst, LLVMUndefValueValueKind);