summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-05-31 22:58:48 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-05-31 22:58:48 +0000
commit288e86ff6b6f2ba35ab9efb9584b572b84b61b35 (patch)
tree2311aff091be29d97b11c90016e075c6c86b5bb3 /llvm/lib/Transforms
parent7385a5ae0b8d8de1ccc73552e2eb97675678f52c (diff)
downloadbcm5719-llvm-288e86ff6b6f2ba35ab9efb9584b572b84b61b35.tar.gz
bcm5719-llvm-288e86ff6b6f2ba35ab9efb9584b572b84b61b35.zip
add -bounds-checking-multiple-traps option to make one trap BB per check
disabled by default for now; we can discusse the default value (& name) later llvm-svn: 157777
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/BoundsChecking.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/BoundsChecking.cpp b/llvm/lib/Transforms/Scalar/BoundsChecking.cpp
index 738b1f27bdb..2ed65ebbab1 100644
--- a/llvm/lib/Transforms/Scalar/BoundsChecking.cpp
+++ b/llvm/lib/Transforms/Scalar/BoundsChecking.cpp
@@ -20,6 +20,7 @@
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/IRBuilder.h"
@@ -35,6 +36,9 @@
#include "llvm/Pass.h"
using namespace llvm;
+static cl::opt<bool> ManyTrapBB("bounds-checking-multiple-traps",
+ cl::desc("Use one trap block per assertion"));
+
STATISTIC(ChecksAdded, "Bounds checks added");
STATISTIC(ChecksSkipped, "Bounds checks skipped");
STATISTIC(ChecksUnable, "Bounds checks unable to add");
@@ -98,7 +102,7 @@ INITIALIZE_PASS_END(BoundsChecking, "bounds-checking",
/// getTrapBB - create a basic block that traps. All overflowing conditions
/// branch to this block. There's only one trap block per function.
BasicBlock *BoundsChecking::getTrapBB() {
- if (TrapBB)
+ if (TrapBB && !ManyTrapBB)
return TrapBB;
BasicBlock::iterator PrevInsertPoint = Builder->GetInsertPoint();
OpenPOWER on IntegriCloud