aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2023-03-03 13:23:27 +0100
committerNikita Popov <npopov@redhat.com>2023-03-03 13:26:29 +0100
commit4d59ffb0d19a40c974ce930e8e9336d3df4d2dd3 (patch)
treeb2102e69ca4cfa70562556be8f5b37852c7b102a /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parentf747cba68d36d24a33f0d36f7ac5bfd840499937 (diff)
downloadllvm-4d59ffb0d19a40c974ce930e8e9336d3df4d2dd3.zip
llvm-4d59ffb0d19a40c974ce930e8e9336d3df4d2dd3.tar.gz
llvm-4d59ffb0d19a40c974ce930e8e9336d3df4d2dd3.tar.bz2
[InstCombine] Simplify separate_storage assumptions
Before this change, we call getUnderlyingObject on each separate_storage operand on every alias() call (potentially requiring lots of pointer chasing). Instead, we rewrite the assumptions in instcombine to do this pointer-chasing once. We still leave the getUnderlyingObject calls in alias(), just expecting them to be no-ops much of the time. This is relatively fast (just a couple dyn_casts with no pointer chasing) and avoids making alias analysis results depend on whether or not instcombine has been run. Differential Revision: https://reviews.llvm.org/D144933
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index b677eae..f806e37 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1516,6 +1516,8 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size,
assert(OBU.Inputs.size() == 2);
const Value *Hint1 = OBU.Inputs[0].get();
const Value *Hint2 = OBU.Inputs[1].get();
+ // This is often a no-op; instcombine rewrites this for us. No-op
+ // getUnderlyingObject calls are fast, though.
const Value *HintO1 = getUnderlyingObject(Hint1);
const Value *HintO2 = getUnderlyingObject(Hint2);