[CaptureTracking] Avoid overly restrictive dominates check
authorAnna Thomas <anna@azul.com>
Tue, 3 Nov 2020 16:06:41 +0000 (11:06 -0500)
committerAnna Thomas <anna@azul.com>
Thu, 5 Nov 2020 16:38:50 +0000 (11:38 -0500)
commit15694fd6ad955c6a16b446a6324364111a49ae8b
treeb86233753cc769fb9d1ac61a3a4e09bb8c5d7a00
parent79d16764dd29aeddb7e6400e6b2d89d31653886c
[CaptureTracking] Avoid overly restrictive dominates check

CapturesBefore tracker has an overly restrictive dominates check when
the `BeforeHere` and the capture point are in different basic blocks.
All we need to check is that there is no path from the capture point
to `BeforeHere` (which is less stricter than the dominates check).
See added testcase in one of the users of CapturesBefore.

Reviewed-By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90688
llvm/lib/Analysis/CaptureTracking.cpp
llvm/test/Transforms/MemCpyOpt/callslot.ll