[ScopDetection] Check for already known required-invariant loads [NFC]

For certain test cases we spent over 50% of the scop detection time in
checking if a load is likely invariant. We can avoid most of these checks by
testing early on if a load is expected to be invariant. Doing this reduces
scop-detection time on a large benchmark from 52 seconds to just 25 seconds.

No functional change is expected.

llvm-svn: 302134
This commit is contained in:
Tobias Grosser 2017-05-04 10:16:20 +00:00
parent 4f1f64174b
commit 3f25a7e8ee
1 changed files with 8 additions and 0 deletions

View File

@ -350,6 +350,14 @@ bool ScopDetection::onlyValidRequiredInvariantLoads(
return false;
for (LoadInst *Load : RequiredILS) {
// If we already know a load has been accepted as required invariant, we
// already run the validation below once and consequently don't need to
// run it again. Hence, we return early. For certain test cases (e.g.,
// COSMO this avoids us spending 50% of scop-detection time in this
// very function (and its children).
if (Context.RequiredILS.count(Load))
continue;
if (!isHoistableLoad(Load, CurRegion, *LI, *SE, *DT))
return false;