[PATCH] D15825: [MDA] Don't be quite as conservative for noalias functions
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 30 08:41:05 PST 2015
reames created this revision.
reames added reviewers: dberlin, hfinkel, sanjoy.
reames added a subscriber: llvm-commits.
(I just want a second look at this patch for sanity sake.)
If we encounter a noalias call that alias analysis can't analyse, we can fall down into the generic call handling rather than giving up entirely. I noticed this while reading through the code for another purpose.
I can't seem to write a test case which changes; that sorta makes sense given any test case would have to be an inconsistency in AA. Suggestions welcome.
@@ -685,13 +685,13 @@
- // Be conservative if the accessed pointer may alias the allocation.
- if (AA->alias(Inst, AccessPtr) != NoAlias)
- return MemDepResult::getClobber(Inst);
- // If the allocation is not aliased and does not read memory (like
- // strdup), it is safe to ignore.
- if (isa<AllocaInst>(Inst) ||
- isMallocLikeFn(Inst, TLI) || isCallocLikeFn(Inst, TLI))
+ // Be conservative if the accessed pointer may alias the allocation -
+ // fallback to the generic handling below.
+ if ((AA->alias(Inst, AccessPtr) == NoAlias) &&
+ // If the allocation is not aliased and does not read memory (like
+ // strdup), it is safe to ignore.
+ (isa<AllocaInst>(Inst) || isMallocLikeFn(Inst, TLI) ||
+ isCallocLikeFn(Inst, TLI)))
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1152 bytes
Desc: not available
More information about the llvm-commits