[llvm] bfd31c6 - [MemorySSA][NFC] Use const whenever possible
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 19 19:22:19 PDT 2022
Author: luxufan
Date: 2022-09-20T02:21:02Z
New Revision: bfd31c6f12f1645a186ff1d521575b92a08d1231
URL: https://github.com/llvm/llvm-project/commit/bfd31c6f12f1645a186ff1d521575b92a08d1231
DIFF: https://github.com/llvm/llvm-project/commit/bfd31c6f12f1645a186ff1d521575b92a08d1231.diff
LOG: [MemorySSA][NFC] Use const whenever possible
Differential Revision: https://reviews.llvm.org/D134162
Added:
Modified:
llvm/include/llvm/Analysis/MemorySSA.h
llvm/lib/Analysis/MemorySSA.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index ac1daf8b0580..4a5eeb5a4020 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -1241,7 +1241,7 @@ class upward_defs_iterator
/// Returns true if \p Ptr is guaranteed to be loop invariant for any possible
/// loop. In particular, this guarantees that it only references a single
/// MemoryLocation during execution of the containing function.
- bool IsGuaranteedLoopInvariant(Value *Ptr) const;
+ bool IsGuaranteedLoopInvariant(const Value *Ptr) const;
void fillInCurrentPair() {
CurrentPair.first = *DefIterator;
@@ -1252,7 +1252,7 @@ class upward_defs_iterator
// to unknown guarantees that any memory accesses that access locations
// after the pointer are considered as clobbers, which is important to
// catch loop carried dependences.
- if (!IsGuaranteedLoopInvariant(const_cast<Value *>(Location.Ptr)))
+ if (!IsGuaranteedLoopInvariant(Location.Ptr))
CurrentPair.second =
Location.getWithNewSize(LocationSize::beforeOrAfterPointer());
PHITransAddr Translator(
@@ -1267,7 +1267,7 @@ class upward_defs_iterator
CurrentPair.second = CurrentPair.second.getWithNewPtr(TransAddr);
if (TransAddr &&
- !IsGuaranteedLoopInvariant(const_cast<Value *>(TransAddr)))
+ !IsGuaranteedLoopInvariant(TransAddr))
CurrentPair.second = CurrentPair.second.getWithNewSize(
LocationSize::beforeOrAfterPointer());
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 30e85dce77b0..ece45e528d10 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -2638,8 +2638,8 @@ void MemoryUse::deleteMe(DerivedUser *Self) {
delete static_cast<MemoryUse *>(Self);
}
-bool upward_defs_iterator::IsGuaranteedLoopInvariant(Value *Ptr) const {
- auto IsGuaranteedLoopInvariantBase = [](Value *Ptr) {
+bool upward_defs_iterator::IsGuaranteedLoopInvariant(const Value *Ptr) const {
+ auto IsGuaranteedLoopInvariantBase = [](const Value *Ptr) {
Ptr = Ptr->stripPointerCasts();
if (!isa<Instruction>(Ptr))
return true;
More information about the llvm-commits
mailing list