[clang] [Clang] Overflow Pattern Exclusions (PR #100272)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 15:07:07 PDT 2024


bwendling wrote:

> @efriedma-quic
> 
> > I think serialization is missing for the new bit on BinaryOperator.
> 
> How do I add this?
> 
> > I'm not sure why we're storing it in the first place, though; it's queried in exactly one place, so there isn't really any benefit to precomputing it.
> 
> It's queried when we check if we can elide the overflow sanitizer check, at this point we're dealing with the BO responsible for the addition (or subtraction) and not with the BO responsible for comparison. To properly check for the entire pattern I am trying to exclude I am pretty sure I need that comparison BO; so I can either precompute comparison BOs and store a bit on its child BO or I navigate up the parent map from the child during the overflow ellision check.
> 
> Which is the better approach?

After chatting with Justin, I agree that precomputing this flag is a better option. The flag is set while processing the comparison operator, during which it sets the flag on its children. Trying to go from the bottom-up to see if an addition statement has this flag set is much harder to do and filled with potential pitfalls.

https://github.com/llvm/llvm-project/pull/100272


More information about the cfe-commits mailing list