[PATCH] D20776: [CFLAA] Teach cfl-aa to understand heap memory allocation

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Sun May 29 17:03:27 PDT 2016


george.burgess.iv added a comment.

Tests would be appreciated here, too, please. :)


================
Comment at: lib/Analysis/CFLAliasAnalysis.cpp:387
@@ +386,3 @@
+    // on the heap. Those kinds of functions do not introduce any aliases.
+    if (isAllocLikeFn(&Inst, &TLI) || isFreeCall(&Inst, &TLI))
+      return;
----------------
This looks a bit sketchy, because `isAllocLikeFn` returns true for `strdup`/`strndup`, both of which copy arbitrary bits from a source to a destination. It also looks like BasicAA (line 766) opts to be conservative with `strdup`/`strndup`.

That said, given how we currently handle external function calls + conversions of pointers to ints (and back), I'm not sure if allowing strdup here can break anything that has a reasonable chance of success in the first place.

...So, I'm really tempted to say "please do the same thing as BasicAA here and add a TODO that we'll address when external values/other CFLAA features are in, so this doesn't come back to subtly bite us in the future."


http://reviews.llvm.org/D20776





More information about the llvm-commits mailing list