diff --git a/llvm/lib/Analysis/CFLGraph.h b/llvm/lib/Analysis/CFLGraph.h --- a/llvm/lib/Analysis/CFLGraph.h +++ b/llvm/lib/Analysis/CFLGraph.h @@ -429,12 +429,9 @@ if (Call.getType()->isPointerTy()) addNode(&Call); - // Check if Inst is a call to a library function that - // allocates/deallocates on the heap. Those kinds of functions do not - // introduce any aliases. - // TODO: address other common library functions such as realloc(), - // strdup(), etc. - if (isMallocOrCallocLikeFn(&Call, &TLI) || isFreeCall(&Call, &TLI)) + // Check if Inst is a call to a library function that frees memory. Those + // kinds of functions do not introduce any aliases. + if (isFreeCall(&Call, &TLI)) return; // TODO: Add support for noalias args/all the other fun function @@ -448,7 +445,7 @@ // could have happened to the arguments (unless the function is marked // readonly or readnone), and that the result could alias just about // anything, too (unless the result is marked noalias). - if (!Call.onlyReadsMemory()) + if (!(Call.onlyReadsMemory() || Call.onlyAccessesInaccessibleMemory())) for (Value *V : Call.args()) { if (V->getType()->isPointerTy()) { // The argument itself escapes.