[PATCH] D64052: Return Undef from isBytewiseValue for empty arrays or structs

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 19:23:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
vitalybuka marked an inline comment as done.
Closed by commit rL365864: Return Undef from isBytewiseValue for empty arrays or structs (authored by vitalybuka, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64052?vs=207664&id=209403#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64052/new/

https://reviews.llvm.org/D64052

Files:
  llvm/trunk/lib/Analysis/ValueTracking.cpp
  llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp


Index: llvm/trunk/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp
@@ -3178,6 +3178,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:
Index: llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp
===================================================================
--- llvm/trunk/unittests/Analysis/ValueTrackingTest.cpp
+++ llvm/trunk/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",
     },
     {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64052.209403.patch
Type: text/x-patch
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/1c89edaf/attachment-0001.bin>


More information about the llvm-commits mailing list