This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Support signed predicates in applyLoopGuards.
ClosedPublic

Authored by fhahn on Jun 22 2021, 11:37 AM.

Details

Summary

This adds handling for signed predicates, similar to how unsigned
predicates are already handled.

Diff Detail

Event Timeline

fhahn created this revision.Jun 22 2021, 11:37 AM
fhahn requested review of this revision.Jun 22 2021, 11:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2021, 11:37 AM

Seems fine to me.

nikic accepted this revision.Jun 22 2021, 12:10 PM

LGTM

This revision is now accepted and ready to land.Jun 22 2021, 12:10 PM
This revision was landed with ongoing or failed builds.Jun 23 2021, 2:22 AM
This revision was automatically updated to reflect the committed changes.

Hi. It looks like this is causing the polly test failure we're seeing on our builders (https://luci-milo.appspot.com/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8843641688849975440?). Could you take a look and send out a fix or revert? Thanks.

******************** TEST 'Polly :: ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll' FAILED ********************
Script:
--
: 'RUN: at line 1';   opt  -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names  -polly-import-jscop-dir=/b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo  -polly-codegen-verify  -analyze -polly-detect-fortran-arrays  -polly-scops -polly-allow-nonaffine -polly-invariant-load-hoisting < /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll | FileCheck /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll
--
Exit Code: 1

Command Output (stderr):
--
/b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll:68:10: error: CHECK: expected string not found in input
; CHECK: MayWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0]
         ^
<stdin>:1:1: note: scanning from here
Printing analysis 'Polly - Create polyhedral description of Scops' for region: '6 => return.loopexit' in function 'testfunc':
^
<stdin>:46:3: note: possible intended match here
 MustWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0]
  ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: Printing analysis 'Polly - Create polyhedral description of Scops' for region: '6 => return.loopexit' in function 'testfunc': 
check:68'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: Invalid Scop! 
check:68'0     ~~~~~~~~~~~~~~
            3: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'entry.split => return' in function 'testfunc': 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4:  Function: testfunc 
check:68'0     ~~~~~~~~~~~~~~~~~~~~
            5:  Region: %entry.split---%return 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            6:  Max Loop Depth: 1 
check:68'0     ~~~~~~~~~~~~~~~~~~~
            .
            .
            .
           41:  Stmt_6 
check:68'0     ~~~~~~~~
           42:  Domain := 
check:68'0     ~~~~~~~~~~~
           43:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] : 0 <= i0 < tmp6 }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           44:  Schedule := 
check:68'0     ~~~~~~~~~~~~~
           45:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] -> [i0] }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           46:  MustWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0] 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:68'1       ?                                                                                    possible intended match
           47:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] -> MemRef_tmp5[i0, 0] }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           48:  } 
check:68'0     ~~~
           49: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'entry => <Function Return>' in function 'testfunc': 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           50: Invalid Scop! 
check:68'0     ~~~~~~~~~~~~~~
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  Polly :: ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll

Hi. It looks like this is causing the polly test failure we're seeing on our builders (https://luci-milo.appspot.com/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8843641688849975440?). Could you take a look and send out a fix or revert? Thanks.

******************** TEST 'Polly :: ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll' FAILED ********************
Script:
--
: 'RUN: at line 1';   opt  -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names  -polly-import-jscop-dir=/b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo  -polly-codegen-verify  -analyze -polly-detect-fortran-arrays  -polly-scops -polly-allow-nonaffine -polly-invariant-load-hoisting < /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll | FileCheck /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll
--
Exit Code: 1

Command Output (stderr):
--
/b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll:68:10: error: CHECK: expected string not found in input
; CHECK: MayWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0]
         ^
<stdin>:1:1: note: scanning from here
Printing analysis 'Polly - Create polyhedral description of Scops' for region: '6 => return.loopexit' in function 'testfunc':
^
<stdin>:46:3: note: possible intended match here
 MustWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0]
  ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-project/polly/test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: Printing analysis 'Polly - Create polyhedral description of Scops' for region: '6 => return.loopexit' in function 'testfunc': 
check:68'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: Invalid Scop! 
check:68'0     ~~~~~~~~~~~~~~
            3: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'entry.split => return' in function 'testfunc': 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4:  Function: testfunc 
check:68'0     ~~~~~~~~~~~~~~~~~~~~
            5:  Region: %entry.split---%return 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            6:  Max Loop Depth: 1 
check:68'0     ~~~~~~~~~~~~~~~~~~~
            .
            .
            .
           41:  Stmt_6 
check:68'0     ~~~~~~~~
           42:  Domain := 
check:68'0     ~~~~~~~~~~~
           43:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] : 0 <= i0 < tmp6 }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           44:  Schedule := 
check:68'0     ~~~~~~~~~~~~~
           45:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] -> [i0] }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           46:  MustWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0] 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:68'1       ?                                                                                    possible intended match
           47:  [tmp6, p_1, MemRef_tmp5_fortranarr_size] -> { Stmt_6[i0] -> MemRef_tmp5[i0, 0] }; 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           48:  } 
check:68'0     ~~~
           49: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'entry => <Function Return>' in function 'testfunc': 
check:68'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           50: Invalid Scop! 
check:68'0     ~~~~~~~~~~~~~~
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  Polly :: ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll

I'm pretty sure polly is documented as not being the first-tier project, and is excluded from being the reason for reverts.
If i'm wrong i would like to be corrected.

Hi. It looks like this is causing the polly test failure we're seeing on our builders (https://luci-milo.appspot.com/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8843641688849975440?). Could you take a look and send out a fix or revert? Thanks.

Thanks for the heads-up. It looks like the polly test just needs updating. I won't be able to do that in the next 12 hours or so. I'm not sure about the policy with respect to Polly, but if it is blocking you, it would be great if you could revert it in the meantime.

I'm pretty sure polly is documented as not being the first-tier project, and is excluded from being the reason for reverts.
If i'm wrong i would like to be corrected.

I hereby correct you.

It was originally proposed by Renato, but in a followup [2] it is made clear that "we should not break it" [3].

[1] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146337.html
[2] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146349.html
[3] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146357.html

Thanks for the heads-up. It looks like the polly test just needs updating. I won't be able to do that in the next 12 hours or so. I'm not sure about the policy with respect to Polly, but if it is blocking you, it would be great if you could revert it in the meantime.

Fixed in https://reviews.llvm.org/rG84046ebd9543d60832d9a580bcbe2e3e5acc3217

fhahn added a comment.Jun 24 2021, 1:17 AM

I'm pretty sure polly is documented as not being the first-tier project, and is excluded from being the reason for reverts.
If i'm wrong i would like to be corrected.

I hereby correct you.

It was originally proposed by Renato, but in a followup [2] it is made clear that "we should not break it" [3].

[1] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146337.html
[2] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146349.html
[3] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146357.html

Thanks for the heads-up. It looks like the polly test just needs updating. I won't be able to do that in the next 12 hours or so. I'm not sure about the policy with respect to Polly, but if it is blocking you, it would be great if you could revert it in the meantime.

Fixed in https://reviews.llvm.org/rG84046ebd9543d60832d9a580bcbe2e3e5acc3217

Thank you very much Michael!