LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 32997 - [Polly - AST Generation] Use != for upper loop bound
Summary: [Polly - AST Generation] Use != for upper loop bound
Status: NEW
Alias: None
Product: Polly
Classification: Unclassified
Component: isl (show other bugs)
Version: unspecified
Hardware: PC Linux
: P enhancement
Assignee: Polly Development Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-10 23:32 PDT by Tobias Grosser
Modified: 2017-05-10 23:32 PDT (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Grosser 2017-05-10 23:32:31 PDT
Currently the isl AST generator derives

for (long i = LB; i <= UB; i++)
  A[i]

for most loops. An alternative would be to generate

for (long i = LB; i != UB + 1; i++)
  A[i]

In the second version a value of LB that is strictly larger than UB + 1 will cause i to eventually overflow. As we know this is not valid (and we annotate i in Polly with NSW), the IR carries the information that such an overflow can never happen
and consequently that LB must be smaller or equal to UB + 1.

LLVM and its -indvars pass prefers the second alternative precisely for this reason.

We should consider to generate IR with the above type.