[PATCH] [BasicAA] Add add-hoc rule to distinguish different fields in arrays of structs.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Fri Feb 6 19:02:02 PST 2015
Thanks for the review!
================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1016-1020
@@ +1015,7 @@
+
+ // Find the last-indexed type of the GEP, i.e., the type you'd get if
+ // you stripped the last index.
+ // On the way, look at each indexed type. If there's something other
+ // than an array, different indices can lead to different final types.
+ auto LookThroughArrayIndices = [](const GEPOperator *GEP) -> StructType *{
+ SmallVector<Value *, 8> IntermediateIndices;
----------------
chandlerc wrote:
> I still think this would all be much more readable in a separate static helper function rather than being inlined (even using lambdas heavily like this to get early return).
>
> This lambda wouldn't be needed, the code would be much less indented, and it would be a good place to hang the high-level comments about this approach, and a good place to add other structural analysis of GEPs in the future.
Fair enough; did that, and made it return AA::AliasResult. The name is overly specific, but for now that's fine.
http://reviews.llvm.org/D7453
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list