[PATCH] D68928: Fix clone_constant_impl to correctly deal with null pointers
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 4 20:55:20 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG31be9f3f7dee: Fix clone_constant_impl to correctly deal with null pointers (authored by aqjune).
Changed prior to commit:
https://reviews.llvm.org/D68928?vs=224784&id=227817#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68928/new/
https://reviews.llvm.org/D68928
Files:
llvm/test/Bindings/llvm-c/echo.ll
llvm/tools/llvm-c-test/echo.cpp
Index: llvm/tools/llvm-c-test/echo.cpp
===================================================================
--- llvm/tools/llvm-c-test/echo.cpp
+++ llvm/tools/llvm-c-test/echo.cpp
@@ -326,6 +326,13 @@
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);
Index: llvm/test/Bindings/llvm-c/echo.ll
===================================================================
--- llvm/test/Bindings/llvm-c/echo.ll
+++ llvm/test/Bindings/llvm-c/echo.ll
@@ -21,6 +21,7 @@
@protected = protected global i32 23
@section = global i32 27, section ".custom"
@align = global i32 31, align 4
+ at nullptr = global i32* null
@aliased1 = alias i32, i32* @var
@aliased2 = internal alias i32, i32* @var
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68928.227817.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191105/9015f53e/attachment.bin>
More information about the llvm-commits
mailing list