[PATCH] D20495: [BasicAA] An inbounds GEP and an alloca can't alias if the base of the GEP would point "below" the alloca
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 13:59:22 PDT 2016
davidxl added inline comments.
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:355
@@ -356,2 +354,3 @@
+ Decomposed.OtherOffset = 0;
do {
// See if this is a bitcast or GEP.
----------------
Also clear the var indices?
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:996
@@ +995,3 @@
+ // from the alloca precisely, so no variable indices are allowed.
+ if (!isa<AllocaInst>(DecompAlloca.Base) || !DecompAlloca.VarIndices.empty())
+ return false;
----------------
Is the VarIndices.empty() check too restrictive?
struct A {
int a[2];
...
};
struct B {
int b1;
int b2;
int b3;
};
struct A a;
B *bp;
bp->b3 vs a.a[i] should produce no aliasing
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:998
@@ -997,3 @@
- // assert.
- if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
- return MayAlias;
----------------
Extract this unrelated cleanup into separate patch.
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1035
@@ -1034,3 @@
- // FIXME: They always have a DataLayout, so this should become an assert.
- if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
- return MayAlias;
----------------
separate out clean up code into different patch.
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1085
@@ -1084,3 @@
- // FIXME: They always have a DataLayout, so this should become an assert.
- if (GEP1BasePtr != UnderlyingV1) {
- return MayAlias;
----------------
Ditto -- cleanup patch.
http://reviews.llvm.org/D20495
More information about the llvm-commits
mailing list