summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorAnna Thomas <anna@azul.com>2017-01-20 00:21:33 +0000
committerAnna Thomas <anna@azul.com>2017-01-20 00:21:33 +0000
commit698f0deea90697586621fd2d3023228534f5252d (patch)
tree342dc0ebd8bdb026c122dccfada0233939738b19 /llvm/lib/Analysis/AliasAnalysis.cpp
parentfd3dae024f861906a284ddb3d4a26cd832e76965 (diff)
downloadbcm5719-llvm-698f0deea90697586621fd2d3023228534f5252d.tar.gz
bcm5719-llvm-698f0deea90697586621fd2d3023228534f5252d.zip
[AliasAnalysis] Fences do not modify constant memory location
Summary: Fence instructions are currently marked as `ModRef` for all memory locations. We can improve this for constant memory locations (such as constant globals), since fence instructions cannot modify these locations. This helps us to forward constant loads across fences (added test case in GVN). There were no changes in behaviour for similar test cases in early-cse and licm. Reviewers: dberlin, sanjoy, reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28914 llvm-svn: 292546
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 84da76be98b..fbc030b26aa 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -367,6 +367,14 @@ ModRefInfo AAResults::getModRefInfo(const StoreInst *S,
return MRI_Mod;
}
+ModRefInfo AAResults::getModRefInfo(const FenceInst *S, const MemoryLocation &Loc) {
+ // If we know that the location is a constant memory location, the fence
+ // cannot modify this location.
+ if (Loc.Ptr && pointsToConstantMemory(Loc))
+ return MRI_Ref;
+ return MRI_ModRef;
+}
+
ModRefInfo AAResults::getModRefInfo(const VAArgInst *V,
const MemoryLocation &Loc) {
OpenPOWER on IntegriCloud