aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp17
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp17
2 files changed, 17 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 7b2f91f..75fe68a8 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -908,3 +908,20 @@ bool llvm::isNotVisibleOnUnwind(const Value *Object,
return false;
}
+
+// We don't consider globals as writable: While the physical memory is writable,
+// we may not have provenance to perform the write.
+bool llvm::isWritableObject(const Value *Object) {
+ // TODO: Alloca might not be writable after its lifetime ends.
+ // See https://github.com/llvm/llvm-project/issues/51838.
+ if (isa<AllocaInst>(Object))
+ return true;
+
+ // TODO: Also handle sret.
+ if (auto *A = dyn_cast<Argument>(Object))
+ return A->hasByValAttr();
+
+ // TODO: Noalias shouldn't imply writability, this should check for an
+ // allocator function instead.
+ return isNoAliasCall(Object);
+}
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 1d8fef9..ef8a97e 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1943,23 +1943,6 @@ bool isNotVisibleOnUnwindInLoop(const Value *Object, const Loop *L,
isNotCapturedBeforeOrInLoop(Object, L, DT);
}
-// We don't consider globals as writable: While the physical memory is writable,
-// we may not have provenance to perform the write.
-bool isWritableObject(const Value *Object) {
- // TODO: Alloca might not be writable after its lifetime ends.
- // See https://github.com/llvm/llvm-project/issues/51838.
- if (isa<AllocaInst>(Object))
- return true;
-
- // TODO: Also handle sret.
- if (auto *A = dyn_cast<Argument>(Object))
- return A->hasByValAttr();
-
- // TODO: Noalias has nothing to do with writability, this should check for
- // an allocator function.
- return isNoAliasCall(Object);
-}
-
bool isThreadLocalObject(const Value *Object, const Loop *L, DominatorTree *DT,
TargetTransformInfo *TTI) {
// The object must be function-local to start with, and then not captured