[PATCH] D64052: Return Undef from isBytewiseValue for empty arrays or structs
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 17:17:46 PDT 2019
vitalybuka updated this revision to Diff 207664.
vitalybuka added a comment.
Use size instead of getNumElements
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64052/new/
https://reviews.llvm.org/D64052
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/unittests/Analysis/ValueTrackingTest.cpp
Index: llvm/unittests/Analysis/ValueTrackingTest.cpp
===================================================================
--- llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -810,7 +810,7 @@
"i16* inttoptr (i96 -1 to i16*)",
},
{
- "i8 0",
+ "i8 undef",
"[0 x i8] zeroinitializer",
},
{
@@ -818,7 +818,7 @@
"[0 x i8] undef",
},
{
- "i8 0",
+ "i8 undef",
"[5 x [0 x i8]] zeroinitializer",
},
{
@@ -900,7 +900,7 @@
"[2 x i16] [i16 -21836, i16 -21846]]",
},
{
- "i8 0",
+ "i8 undef",
"{ } zeroinitializer",
},
{
@@ -908,7 +908,7 @@
"{ } undef",
},
{
- "i8 0",
+ "i8 undef",
"{ {}, {} } zeroinitializer",
},
{
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -3179,6 +3179,10 @@
if (isa<UndefValue>(V))
return UndefInt8;
+ const uint64_t Size = DL.getTypeStoreSize(V->getType());
+ if (!Size)
+ return UndefInt8;
+
Constant *C = dyn_cast<Constant>(V);
if (!C) {
// Conceptually, we could handle things like:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64052.207664.patch
Type: text/x-patch
Size: 1333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/c0d8142b/attachment.bin>
More information about the llvm-commits
mailing list