[PATCH] D59218: [LSR] Fix signed overflow in GenerateCrossUseConstantOffsets.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 14:52:18 PDT 2019



> On 25 Mar 2019, at 21:44, Eli Friedman via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> efriedma added inline comments.
> 
> 
> ================
> Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4142
> +          // First + Last = 2 * (First + Last) + (First ^ Last).
> +          Imms.lower_bound((First & Last) + (First ^ Last) / 2)};
>       for (size_t i = 0, e = array_lengthof(OtherImms); i != e; ++i) {
> ----------------
> Are you sure this formula is right? Alive says it doesn't work correctly for signed values: https://rise4fun.com/Alive/E3V.

Hm I think i just found a simple counter example. I’ll check it again tomorrow.


More information about the llvm-commits mailing list