[PATCH] D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 20 11:27:31 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/CodeGen/CodeGenFunction.h:383
+  // This stack is used/maintained exclusively by the implicit cast sanitizer.
+  llvm::SmallVector<const CastExpr *, 8> CastExprStack;
+
----------------
vsk wrote:
> lebedev.ri wrote:
> > vsk wrote:
> > > lebedev.ri wrote:
> > > > vsk wrote:
> > > > > Why not 0 instead of 8, given that in the common case, this stack is unused?
> > > > No longer relevant.
> > > I'm referring to CastExprStack within ScalarExprEmitter, which still allocates space for 8 pointers inline.
> > Ah, you mean in the general case when the sanitizer is disabled?
> > 
> Yes. It's a relatively minor concern, but clang's stack can get pretty deep inside of CodeGenFunction. At one point we needed to outline code by hand to unbreak the ASan build. Later I think we just increased the stack size rlimit. I don't see a countervailing performance benefit of allocating more space inline, at least not here.
No, i agree and totally understand.
I just didn't think about that sanitizer-less context.


Repository:
  rC Clang

https://reviews.llvm.org/D48958





More information about the cfe-commits mailing list