summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2019-02-28 04:00:55 +0000
committerRichard Trieu <rtrieu@google.com>2019-02-28 04:00:55 +0000
commitb37a70f40e1229d44b967c339f65f4acfd56b0ce (patch)
tree77aca85d12ab502d09cec645c3e871d8b1fefb5b /llvm/unittests
parent14d58f598691b8c27d8b4a4cf6181178f1a8c295 (diff)
downloadbcm5719-llvm-b37a70f40e1229d44b967c339f65f4acfd56b0ce.tar.gz
bcm5719-llvm-b37a70f40e1229d44b967c339f65f4acfd56b0ce.zip
Fix IR/Analysis layering issue with OptBisect
OptBisect is in IR due to LLVMContext using it. However, it uses IR units from Analysis as well. This change moves getDescription functions from OptBisect to their respective IR units. Generating names for IR units will now be up to the callers, keeping the Analysis IR units in Analysis. To prevent unnecessary string generation, isEnabled function is added so that callers know when the description needs to be generated. Differential Revision: https://reviews.llvm.org/D58406 llvm-svn: 355068
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/IR/LegacyPassManagerTest.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/unittests/IR/LegacyPassManagerTest.cpp b/llvm/unittests/IR/LegacyPassManagerTest.cpp
index ea3b112f2a5..6c0c251aff9 100644
--- a/llvm/unittests/IR/LegacyPassManagerTest.cpp
+++ b/llvm/unittests/IR/LegacyPassManagerTest.cpp
@@ -400,7 +400,12 @@ namespace llvm {
struct CustomOptPassGate : public OptPassGate {
bool Skip;
CustomOptPassGate(bool Skip) : Skip(Skip) { }
- bool shouldRunPass(const Pass *P, const Module &U) { return !Skip; }
+ bool shouldRunPass(const Pass *P, StringRef IRDescription) {
+ if (P->getPassKind() == PT_Module)
+ return !Skip;
+ return OptPassGate::shouldRunPass(P, IRDescription);
+ }
+ bool isEnabled() const { return true; }
};
// Optional module pass.
OpenPOWER on IntegriCloud