[PATCH] D21007: DSE: Don't remove stores made live by a call which unwinds.
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 08:30:30 PDT 2016
dberlin added a subscriber: dberlin.
================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:828
@@ +827,3 @@
+ size_t LastThrowingInstIndex = 0;
+ DenseMap<Instruction*, size_t> InstrOrdering;
+ size_t InstrIndex = 1;
----------------
Is this different from orderedbasicblock?
================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:1066
@@ +1065,3 @@
+ // the store.
+ size_t DepIndex = InstrOrdering.lookup(DepWrite);
+ assert(DepIndex && "Unexpected instruction");
----------------
(and fwiw, memdep does not consider maythrow, only aliasing. AFAIK, it will never return a maythrow call as a dep unless it thinks, conservatively, that it aliases the pointer. It mostly does think that when we don't have good call mod/ref info, but when we do, it happily does not return maythrow calls as deps)
================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:1073
@@ +1072,3 @@
+ IsStoreDeadOnUnwind = isAllocLikeFn(Underlying, TLI) &&
+ !PointerMayBeCapturedBefore(Underlying, true, true, LastThrowingInst, DT, true);
+ }
----------------
PointerMayBeCapturedBefore is an O(N) call, at best.
It even says " This routine can be expensive, so consider
/// caching the results. "
Can we really not do better?
https://reviews.llvm.org/D21007
More information about the llvm-commits
mailing list