[PATCH] D134162: [MemorySSA][NFC] Use const whenever possible
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 18 23:28:56 PDT 2022
StephenFan created this revision.
StephenFan added reviewers: nikic, asbirlea.
Herald added subscribers: george.burgess.iv, hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134162
Files:
llvm/include/llvm/Analysis/MemorySSA.h
llvm/lib/Analysis/MemorySSA.cpp
Index: llvm/lib/Analysis/MemorySSA.cpp
===================================================================
--- llvm/lib/Analysis/MemorySSA.cpp
+++ llvm/lib/Analysis/MemorySSA.cpp
@@ -2638,8 +2638,8 @@
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;
Index: llvm/include/llvm/Analysis/MemorySSA.h
===================================================================
--- llvm/include/llvm/Analysis/MemorySSA.h
+++ llvm/include/llvm/Analysis/MemorySSA.h
@@ -1241,7 +1241,7 @@
/// 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 @@
// 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 @@
CurrentPair.second = CurrentPair.second.getWithNewPtr(TransAddr);
if (TransAddr &&
- !IsGuaranteedLoopInvariant(const_cast<Value *>(TransAddr)))
+ !IsGuaranteedLoopInvariant(TransAddr))
CurrentPair.second = CurrentPair.second.getWithNewSize(
LocationSize::beforeOrAfterPointer());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134162.461145.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/e5b66349/attachment.bin>
More information about the llvm-commits
mailing list