[PATCH] D21007: DSE: Don't remove stores made live by a call which unwinds.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 10:25:17 PDT 2016


eli.friedman added a comment.

InstrOrdering is basically an OrderedBasicBlock, I guess... I think I'd need to modify the interface a bit for this exact use to deal with modifications.


================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:1073
@@ +1072,3 @@
+          IsStoreDeadOnUnwind = isAllocLikeFn(Underlying, TLI) &&
+              !PointerMayBeCapturedBefore(Underlying, true, true, LastThrowingInst, DT, true);
+        }
----------------
dberlin wrote:
> 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?
> 
> 
We could try to cache the result, I guess... but I don't think we would end up hitting any such cache very often, considering that you can only reuse the cache for exactly the same inputs.

I could use PointerMayBeCaptured instead.  Not quite as strong, but I guess the extra accuracy might not be that useful (and it's easier to cache, if necessary).


https://reviews.llvm.org/D21007





More information about the llvm-commits mailing list