diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2016-12-29 00:49:32 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@dberlin.org> | 2016-12-29 00:49:32 +0000 |
commit | 7ad1ea0984eaefd4e508c940bbaf2c86e6d2c3c7 (patch) | |
tree | 7dde5e934070363d3768386dfede35bdbadd21f1 /llvm/lib | |
parent | ddece375a14d152dcb3e36ebc777180ccb2f596d (diff) | |
download | bcm5719-llvm-7ad1ea0984eaefd4e508c940bbaf2c86e6d2c3c7.tar.gz bcm5719-llvm-7ad1ea0984eaefd4e508c940bbaf2c86e6d2c3c7.zip |
Update equalsStoreHelper for the fact that only one branch can be true
llvm-svn: 290697
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 54c0a4bc21d..f7bd629e4a3 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -189,7 +189,7 @@ class NewGVN : public FunctionPass { // We could use the congruence class machinery, but the MemoryAccess's are // abstract memory states, so they can only ever be equivalent to each other, // and not to constants, etc. - DenseMap<MemoryAccess *, MemoryAccess *> MemoryAccessEquiv; + DenseMap<const MemoryAccess *, MemoryAccess *> MemoryAccessEquiv; // Expression to class mapping. using ExpressionClassMap = DenseMap<const Expression *, CongruenceClass *>; @@ -351,14 +351,15 @@ FunctionPass *llvm::createNewGVNPass() { return new NewGVN(); } template <typename T> static bool equalsLoadStoreHelper(const T &LHS, const Expression &RHS) { if ((!isa<LoadExpression>(RHS) && !isa<StoreExpression>(RHS)) || - !LHS.BasicExpression::equals(RHS)) + !LHS.BasicExpression::equals(RHS)) { return false; - if (const auto *L = dyn_cast<LoadExpression>(&RHS)) + } else if (const auto *L = dyn_cast<LoadExpression>(&RHS)) { if (LHS.getDefiningAccess() != L->getDefiningAccess()) return false; - if (const auto *S = dyn_cast<StoreExpression>(&RHS)) + } else if (const auto *S = dyn_cast<StoreExpression>(&RHS)) { if (LHS.getDefiningAccess() != S->getDefiningAccess()) return false; + } return true; } |