[PATCH] D70602: [JumpThreading] NFC: Don't cache F.hasProfileData()

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 08:53:57 PST 2019


kazu created this revision.
Herald added subscribers: jfb, hiraditya.
Herald added a project: LLVM.
kazu accepted this revision.
kazu added a comment.
This revision is now accepted and ready to land.

Self-LGTM as this is a very simple NFC.


With this patch, we no longer cache F.hasProfileData().  We simply
call the function again.

I'm doing this because:

- JumpThreadingPass also has a member variable named HasProfileData, which is very confusing,

- the function is very lightweight, and

- this patch makes JumpThreading::runOnFunction more consistent with JumpThreadingPass::run.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70602

Files:
  llvm/lib/Transforms/Scalar/JumpThreading.cpp


Index: llvm/lib/Transforms/Scalar/JumpThreading.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -306,14 +306,13 @@
   DomTreeUpdater DTU(*DT, DomTreeUpdater::UpdateStrategy::Lazy);
   std::unique_ptr<BlockFrequencyInfo> BFI;
   std::unique_ptr<BranchProbabilityInfo> BPI;
-  bool HasProfileData = F.hasProfileData();
-  if (HasProfileData) {
+  if (F.hasProfileData()) {
     LoopInfo LI{DominatorTree(F)};
     BPI.reset(new BranchProbabilityInfo(F, LI, TLI));
     BFI.reset(new BlockFrequencyInfo(F, *BPI, LI));
   }
 
-  bool Changed = Impl.runImpl(F, TLI, LVI, AA, &DTU, HasProfileData,
+  bool Changed = Impl.runImpl(F, TLI, LVI, AA, &DTU, F.hasProfileData(),
                               std::move(BFI), std::move(BPI));
   if (PrintLVIAfterJumpThreading) {
     dbgs() << "LVI for function '" << F.getName() << "':\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70602.230662.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191122/c759c82e/attachment.bin>


More information about the llvm-commits mailing list