[PATCH] D137149: Use PassGate from LLVMContext if any otherwise global one

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 01:11:48 PST 2022


ebrevnov added inline comments.


================
Comment at: llvm/include/llvm/Passes/StandardInstrumentations.h:81
 public:
-  OptBisectInstrumentation() = default;
+  OptPassGateInstrumentation(LLVMContext &Context) : Context(Context){};
+  bool shouldRun(StringRef PassName, Any IR);
----------------
aeubanks wrote:
> clang-format?
clang-format works this way for me...what problem do you see here?


================
Comment at: llvm/lib/Passes/StandardInstrumentations.cpp:771
+  OptPassGate &PassGate = Context.getOptPassGate();
+  if (!PassGate.isEnabled())
+    return true;
----------------
aeubanks wrote:
> this should be in `OptPassGateInstrumentation::registerCallbacks` gating `registerShouldRunOptionalPassCallback` to avoid an extra callback per pass run
PassGate can be set/remove/changed to LLVMContext at any time using LLVMContext::setOptPassGate() API. Thus it would be invalid to "cache" the state in the registerCallbacks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137149



More information about the llvm-commits mailing list