[SCEV] Fix potentially empty set for unsigned ranges
authorTejas Joshi <TejasSanjay.Joshi@amd.com>
Mon, 4 Sep 2023 09:46:52 +0000 (10:46 +0100)
committerTobias Hieta <tobias@hieta.se>
Mon, 11 Sep 2023 06:56:18 +0000 (08:56 +0200)
commita9f083d30500565091626213f9775f89b1376335
treeed6d7395a2e7c7f497f7b8dd10b3301edef1eb97
parent7a0ee8a81d86ce4ba73545e3367b10ab685185cb
[SCEV] Fix potentially empty set for unsigned ranges

The following commit enabled the analysis of ranges for heap allocations:
22ca38da25e19a7c5fcfeb3f22159aba92ec381e

The range turns out to be empty in cases such as the one in test (which
is [1,1)), leading to an assertion failure. This patch fixes for the
same case.

Fixes https://github.com/llvm/llvm-project/issues/63856

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D159160

(cherry picked from commit 0609b65aaf03b083d282a4ffe8bf660351dac461)
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/malloc.ll