[PATCH] Handle accesses to sturctures with embedded arrays and different offsets better

Daniel Berlin dberlin at dberlin.org
Fri Mar 20 11:18:58 PDT 2015

Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1072
@@ +1071,3 @@
+        if (isActualObject(UnderlyingV1) && isActualObject(UnderlyingV2) &&
+            GEP1VariableIndices == GEP2VariableIndices)
+          if ((GEP2BaseOffset - (GEP1BaseOffset + V1Size) > 0) ||
Technically, the check should be "if the variable indices are equal, or we can prove they can't have values that make offset, size overlap when they wouldn't otherwise".

In particular, if we could prove the the variable indices are always 0 or positive, they can't overlap.

Sadly, we don't have range info in BasicAA to use, and this check is already strictly better than what we have now.



More information about the llvm-commits mailing list