[PATCH] Optionally extend alloca lifetimes to allow for callslot optimization to happen
listmail at philipreames.com
Mon Mar 2 11:40:30 PST 2015
I'm reasonable sure this code is correct, but I'm not sure it's as well structured as it could be. I reserve the right to be wrong here; you may just need to explain a few things. :)
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:891
@@ +890,3 @@
+ AliasAnalysis::Location DstLoc = AliasAnalysis::getLocationForDest(M);
+ MemDepResult DstDepInfo = MD->getPointerDependencyFrom(DstLoc, true,
+ M, M->getParent());
I'm a bit concerned about running these queries unconditionally. MDA is rather expensive.
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:894
@@ +893,3 @@
+ // If the destination just started its lifetime, pretend that the lifetime
+ // start isn't present, try the callslot optimization and if it succeeds,
I'm not clear I understand the problem here. Is the issue that MD->getDependency is returning the lifetime_start as the dependency but MD->getPointerDependency(Src) is not?
Also, would it be *correct* to always use the source pointer dependency here? Or do you need to consider both source and dest dependencies when considering the callSlotOpt? Depending on the implementation of the callSlotOpt, I could see that going either way.
More information about the llvm-commits