[PATCH] D136827: [JT][CT] Preserve exisiting BPI/BFI during JumpThreading

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 03:11:29 PST 2023


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

LG with some nits



================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:33
 #include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/Analysis/PostDominators.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
----------------
Do you still need this?


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:422
   DominatorTree &DT = DTU->getDomTree();
-  for (auto &BB : F)
+  for (auto &BB : *F) {
     if (!DT.isReachableFromEntry(&BB))
----------------
`{ }` not needed


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:3240
+
+  if (Force || HasProfile) {
+    BPI = runExternalAnalysis<BranchProbabilityAnalysis>();
----------------
`{}` not needed


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:3251
+
+  if (Force || HasProfile) {
+    BFI = runExternalAnalysis<BlockFrequencyAnalysis>();
----------------
same


================
Comment at: llvm/test/Transforms/JumpThreading/select.ll:2
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -passes=jump-threading -debug-only=branch-prob < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes="require<branch-prob>,jump-threading" -debug-only=branch-prob < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
----------------
Add new configuration in addition to old one?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136827/new/

https://reviews.llvm.org/D136827



More information about the llvm-commits mailing list