vitalybuka added inline comments.

================
Comment at: llvm/lib/Analysis/StackSafetyAnalysis.cpp:618
+    ConstantRange Access = Found->sextOrTrunc(Use.Range.getBitWidth());
+    if (Access.signedAddMayOverflow(C.Offset) !=
+        ConstantRange::OverflowResult::NeverOverflows)
----------------
eugenis wrote:
> vitalybuka wrote:
> > eugenis wrote:
> > > Do we have a test for this overflow check?
> > yes
> > Example, in bit width 8
> > [-128,-127)+[-128,-127) = [0,1)
> > both non-wrapped and result is non-wrapped so we have no way to spot 
> > overflow
> Sure. I was asking if we have a testcase that covers the overflow check.
I've extracted this into function and added test to cover that.
It is possible to test this check, however we discussed clamping offsets to 
something more useful, e.g. 2^(ptrwidth/2). This way we will not be able to hit 
this check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81242



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to