This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Check inverse eagerly in isBasicBlockEntryGuardedByCond [NFC]
AbandonedPublic

Authored by reames on Mar 19 2021, 11:07 AM.

Details

Summary

This is an attempt at a compile time optimization for SCEV. (Pending data) The basic idea is to check both the predicate and it's inverse at the same time while walking the CFG.

This should help in two cases:

  1. In the case where the inverse can be proven closer to the query context, running the entire search for the predicate before trying the inverse is very wasteful.
  2. In the case where we can't prove either, we've reduced memory traffic by performing a single CFG walk instead of two.

This could hurt for the case where we prove the predicate since we've run the inverse logic along the way. My intuition is that the benefit will outweigh the cost, but let's see what the data says.

Note: The test changes are in dead code, and thus either result is equally correct.

Diff Detail