[PATCH] D49946: Fix crash in bounds checking

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 16:52:13 PDT 2018


eugenis added inline comments.


================
Comment at: lib/Transforms/Instrumentation/BoundsChecking.cpp:162
   BasicBlock *TrapBB = nullptr;
   auto GetTrapBB = [&TrapBB](BuilderTy &IRB) {
     if (TrapBB && SingleTrapBB)
----------------
Move GetTrapBB definition near the end of the function, where it is first used.



================
Comment at: lib/Transforms/Instrumentation/BoundsChecking.cpp:184
 
-  bool MadeChange = false;
+  SmallVector<std::pair<Value *, BuilderTy>, 4> TrapInfo;
   for (Instruction *Inst : WorkList) {
----------------
It's very uncommon to store builders in containers. Replace with an instruction pointer.

TrapInfo can be combined with WorkList, and both loops can be merged in one.



Repository:
  rL LLVM

https://reviews.llvm.org/D49946





More information about the llvm-commits mailing list