[PATCH] D98972: [SCEV] Check inverse eagerly in isBasicBlockEntryGuardedByCond [NFC]

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 11:07:05 PDT 2021


reames created this revision.
reames added reviewers: mkazantsev, nikic, lebedev.ri.
Herald added subscribers: dantrushin, javed.absar, hiraditya, mcrosier.
Herald added a reviewer: bollu.
reames requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98972

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
  llvm/test/Transforms/IndVarSimplify/X86/pr35406.ll
  llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98972.331939.patch
Type: text/x-patch
Size: 10751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/8dfa1f3d/attachment.bin>


More information about the llvm-commits mailing list