aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-07-12 02:23:07 +0000
committerVitaly Buka <vitalybuka@google.com>2019-07-12 02:23:07 +0000
commit52096ee9a96e1678b82ec225bceb9276b41303e7 (patch)
tree55bcc9b2fa206a63a109ba63c297f411e08959b5 /llvm/lib/Analysis/ValueTracking.cpp
parent8bd441af8b84165ca904772b1e73eaaed4fbe71a (diff)
downloadllvm-52096ee9a96e1678b82ec225bceb9276b41303e7.zip
llvm-52096ee9a96e1678b82ec225bceb9276b41303e7.tar.gz
llvm-52096ee9a96e1678b82ec225bceb9276b41303e7.tar.bz2
Return Undef from isBytewiseValue for empty arrays or structs
Reviewers: pcc, eugenis Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64052 llvm-svn: 365864
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 6857cf4..cf8fa9c 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3178,6 +3178,10 @@ Value *llvm::isBytewiseValue(Value *V, const DataLayout &DL) {
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: