summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index 927c34180db9..3b4d80dc8023 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -27,6 +27,7 @@
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/MDBuilder.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CommandLine.h"
@@ -766,6 +767,11 @@ CHRScope * CHR::findScope(Region *R) {
for (BasicBlock *Pred : predecessors(Entry))
if (R->contains(Pred))
return nullptr;
+ // If any of the basic blocks have address taken, we must skip this region
+ // because we cannot clone basic blocks that have address taken.
+ for (BasicBlock *BB : R->blocks())
+ if (BB->hasAddressTaken())
+ return nullptr;
if (Exit) {
// Try to find an if-then block (check if R is an if-then).
// if (cond) {
@@ -2095,9 +2101,7 @@ PreservedAnalyses ControlHeightReductionPass::run(
bool Changed = CHR(F, BFI, DT, PSI, RI, ORE).run();
if (!Changed)
return PreservedAnalyses::all();
- auto PA = PreservedAnalyses();
- PA.preserve<GlobalsAA>();
- return PA;
+ return PreservedAnalyses::none();
}
} // namespace llvm