[PATCH] D150943: [SimplifyCFG] add nsw on BuildLookuptable LinearMap calculation

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 10 01:38:43 PDT 2023


khei4 added a comment.

@uabelho Thank you for catching this! As you see, attaching NSW to this example you gave seems unreasonable!

I thought switch results values' monotonicity was enough to say wrapping must not happen, but it wasn't correct. 
`(-2, -1, 1, 2)  |→ (-4, -2, 0, 2)` is monotonic, but actual calculation contains ov `(-2, -1, 1, 2)  |→ (0, 1, 2, 3) (*2) |→ (0, 2, 4(ov), 6(ov)) |→ (-4, -2, 0, 2)`.

I think we can handle this case if we calculate the maximum value.

Candidate patch: https://github.com/llvm/llvm-project/pull/65882


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150943



More information about the llvm-commits mailing list