[PATCH] D142330: [AssumptionCache] caches @llvm.experimental.guard's

Joshua Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 00:54:04 PST 2023


caojoshua created this revision.
Herald added subscribers: javed.absar, hiraditya.
Herald added a project: All.
caojoshua added reviewers: fhahn, nikic.
Herald added a subscriber: StephenFan.
caojoshua added a comment.
caojoshua published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

An additional though: I have a lot of asserts that checks `is assume || is guard`. I'd like to add a helper in IntrinsicInst, but there is already a `isAssumeLikeIntrinsic()`, which is completely unrelated to this change. Maybe we can add `isCondGuard()`?


As discussed in https://github.com/llvm/llvm-project/issues/59901

This change is not NFC. There is one SCEV and EarlyCSE test that have an
improved analysis/optimization case. Rest of the tests are not failing.

I've mostly only added cleanup to SCEV since that is where this issue
started. As a follow up, I believe there is more cleanup opportunity in
SCEV and other affected passes.

There could be cases where there are missed registerAssumption of
guards, but this case is not so bad because there will be no
miscompilation. AssumptionCacheTracker should take care of deleted
guards. I believe I covered the only required case of
unregisterAssumption, when a code region is extracted from its function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142330

Files:
  llvm/include/llvm/Analysis/AssumptionCache.h
  llvm/lib/Analysis/AssumeBundleQueries.cpp
  llvm/lib/Analysis/AssumptionCache.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Analysis/ScalarEvolution/guards.ll
  llvm/test/Transforms/EarlyCSE/guards.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142330.491244.patch
Type: text/x-patch
Size: 17697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/4182f1dd/attachment.bin>


More information about the llvm-commits mailing list