[PATCH] D84293: Add an assertion in SmallVector::push_back()

Mehdi AMINI via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 16:57:10 PST 2020


mehdi_amini added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:10811-10813
+    Ops.reserve(Ops.size() + 1);
     Ops.push_back(Ops[0]);
     Ops.erase(Ops.begin());
----------------
njames93 wrote:
> Probably a little off topic, but shouldn't this be refactored as a rotate. Has the advantage that it will never allocate.
> 
Well spotted! I didn't even think about what the code was doing and fixed it mechanically...

I pushed this separately: https://github.com/llvm/llvm-project/commit/42e88bd6b185


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84293/new/

https://reviews.llvm.org/D84293



More information about the cfe-commits mailing list