summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-02-20 00:31:28 +0000
committerPhilip Reames <listmail@philipreames.com>2019-02-20 00:31:28 +0000
commit79d5e16f519a5a807129d2e3100101a4628678ae (patch)
tree1747013169699b418e889e5d6148f79631c7d245 /llvm/lib
parentcadb3652e0178a042396b8ddaef19cfd150e4fb1 (diff)
downloadbcm5719-llvm-79d5e16f519a5a807129d2e3100101a4628678ae.tar.gz
bcm5719-llvm-79d5e16f519a5a807129d2e3100101a4628678ae.zip
[GVN] Small tweaks to comments, style, and missed vector handling
Noticed these while doing a final sweep of the code to make sure I hadn't missed anything in my last couple of patches. The (minor) missed optimization was noticed because of the stylistic fix to avoid an overly specific cast. llvm-svn: 354412
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/VNCoercion.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/VNCoercion.cpp b/llvm/lib/Transforms/Utils/VNCoercion.cpp
index 181e53e7605..19593054c23 100644
--- a/llvm/lib/Transforms/Utils/VNCoercion.cpp
+++ b/llvm/lib/Transforms/Utils/VNCoercion.cpp
@@ -36,8 +36,8 @@ bool canCoerceMustAliasedValueToLoad(Value *StoredVal, Type *LoadTy,
// As a special case, allow coercion of memset used to initialize
// an array w/null. Despite non-integral pointers not generally having a
// specific bit pattern, we do assume null is zero.
- if (auto *CI = dyn_cast<ConstantInt>(StoredVal))
- return CI->isZero();
+ if (auto *CI = dyn_cast<Constant>(StoredVal))
+ return CI->isNullValue();
return false;
}
@@ -287,9 +287,8 @@ int analyzeLoadFromClobberingMemInst(Type *LoadTy, Value *LoadPtr,
// If this is memset, we just need to see if the offset is valid in the size
// of the memset..
if (MI->getIntrinsicID() == Intrinsic::memset) {
- Value *StoredVal = cast<MemSetInst>(MI)->getValue();
if (DL.isNonIntegralPointerType(LoadTy->getScalarType())) {
- auto *CI = dyn_cast<ConstantInt>(StoredVal);
+ auto *CI = dyn_cast<ConstantInt>(cast<MemSetInst>(MI)->getValue());
if (!CI || !CI->isZero())
return -1;
}
@@ -316,7 +315,8 @@ int analyzeLoadFromClobberingMemInst(Type *LoadTy, Value *LoadPtr,
if (Offset == -1)
return Offset;
- // Don't coerce non-integral pointers to integers or vice versa.
+ // Don't coerce non-integral pointers to integers or vice versa, and the
+ // memtransfer is implicitly a raw byte code
if (DL.isNonIntegralPointerType(LoadTy->getScalarType()))
// TODO: Can allow nullptrs from constant zeros
return -1;
OpenPOWER on IntegriCloud