diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
| commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
| tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp index 1eadafb4e4b4..8b1d39ad412f 100644 --- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp +++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp @@ -146,6 +146,7 @@ static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI, const DataLayout &DL = F.getParent()->getDataLayout(); ObjectSizeOpts EvalOpts; EvalOpts.RoundToAlign = true; + EvalOpts.EvalMode = ObjectSizeOpts::Mode::ExactUnderlyingSizeAndOffset; ObjectSizeOffsetEvaluator ObjSizeEval(DL, &TLI, F.getContext(), EvalOpts); // check HANDLE_MEMORY_INST in include/llvm/Instruction.def for memory @@ -221,35 +222,3 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager & return PreservedAnalyses::none(); } - -namespace { -struct BoundsCheckingLegacyPass : public FunctionPass { - static char ID; - - BoundsCheckingLegacyPass() : FunctionPass(ID) { - initializeBoundsCheckingLegacyPassPass(*PassRegistry::getPassRegistry()); - } - - bool runOnFunction(Function &F) override { - auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); - auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); - return addBoundsChecking(F, TLI, SE); - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired<TargetLibraryInfoWrapperPass>(); - AU.addRequired<ScalarEvolutionWrapperPass>(); - } -}; -} // namespace - -char BoundsCheckingLegacyPass::ID = 0; -INITIALIZE_PASS_BEGIN(BoundsCheckingLegacyPass, "bounds-checking", - "Run-time bounds checking", false, false) -INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) -INITIALIZE_PASS_END(BoundsCheckingLegacyPass, "bounds-checking", - "Run-time bounds checking", false, false) - -FunctionPass *llvm::createBoundsCheckingLegacyPass() { - return new BoundsCheckingLegacyPass(); -} |
