[PATCH] D30369: Allow None as a MemoryLocation to getModRefInfo, use it to start cleaning up interfaces and uses

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 17:09:42 PST 2017


dberlin marked 10 inline comments as done.
dberlin added inline comments.


================
Comment at: include/llvm/Analysis/MemoryLocation.h:77-86
     if (auto *I = dyn_cast<LoadInst>(Inst))
       return get(I);
     else if (auto *I = dyn_cast<StoreInst>(Inst))
       return get(I);
     else if (auto *I = dyn_cast<VAArgInst>(Inst))
       return get(I);
     else if (auto *I = dyn_cast<AtomicCmpXchgInst>(Inst))
----------------
dberlin wrote:
> dblaikie wrote:
> > Consider a switch over the inst kind enum to reduce the work repeatedly done by dyn_cast (at least it seems like LLVM code often uses a switch over enum rather than chained dyn_cast - I don't actually know if the overhead is real)
> So i didn't write this,  and i'm happy to clean it up in a future patch, but i want to not touch it here if that's okay, as i would like the patch to change as little as possible :)
> 
> 
> If you stare at MemoryLocation.cpp, you'll see that basically all of these are doing the same thing, and probably could stand a bit of templating.
> 
> Honestly, at this point, we may just want to make the memory instructions able to return a memorylocation in Instructions.h.
> Who knows.
> 
> 
I gave up and fixed it since it looks nicer that way anyway :)



https://reviews.llvm.org/D30369





More information about the llvm-commits mailing list