diff options
| author | 2019-06-23 21:36:31 +0000 | |
|---|---|---|
| committer | 2019-06-23 21:36:31 +0000 | |
| commit | 23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch) | |
| tree | f7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp | |
| parent | sort previous; ok deraadt (diff) | |
| download | wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip | |
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp')
| -rw-r--r-- | gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp index cbb6594cf8f..5983c804c0c 100644 --- a/gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp +++ b/gnu/llvm/lib/Transforms/Scalar/LoopPredication.cpp @@ -178,7 +178,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/LoopPredication.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/BranchProbabilityInfo.h" +#include "llvm/Analysis/GuardUtils.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" @@ -196,6 +198,9 @@ #define DEBUG_TYPE "loop-predication" +STATISTIC(TotalConsidered, "Number of guards considered"); +STATISTIC(TotalWidened, "Number of checks widened"); + using namespace llvm; static cl::opt<bool> EnableIVTruncation("loop-predication-enable-iv-truncation", @@ -574,6 +579,8 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard, LLVM_DEBUG(dbgs() << "Processing guard:\n"); LLVM_DEBUG(Guard->dump()); + TotalConsidered++; + IRBuilder<> Builder(cast<Instruction>(Preheader->getTerminator())); // The guard condition is expected to be in form of: @@ -615,6 +622,8 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard, if (NumWidened == 0) return false; + TotalWidened += NumWidened; + // Emit the new guard condition Builder.SetInsertPoint(Guard); Value *LastCheck = nullptr; @@ -812,9 +821,8 @@ bool LoopPredication::runOnLoop(Loop *Loop) { SmallVector<IntrinsicInst *, 4> Guards; for (const auto BB : L->blocks()) for (auto &I : *BB) - if (auto *II = dyn_cast<IntrinsicInst>(&I)) - if (II->getIntrinsicID() == Intrinsic::experimental_guard) - Guards.push_back(II); + if (isGuard(&I)) + Guards.push_back(cast<IntrinsicInst>(&I)); if (Guards.empty()) return false; |
