[llvm-bugs] [Bug 49967] opt -enable-new-pm=0 -loop-deletion fails with Assertion `!isInvalid() && "Loop not in a valid state!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 18 13:44:21 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49967

Nikita Popov <nikita.ppv at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |nikita.ppv at gmail.com
             Status|NEW                         |RESOLVED

--- Comment #1 from Nikita Popov <nikita.ppv at gmail.com> ---
I've added the test case in
https://github.com/llvm/llvm-project/commit/6e8e165085d4506d3df15da79f70abe1237a26ba.

Here's a trace of what happens in this case:

Fetching:   %inc89 = add nuw nsw i16 %i58.010, 1
Fetching: i16 1
  Reused: 1
Fetching: i16 1
  Reused: 1
Fetching:   %i58.010 = phi i16 [ 32, %vector.ph ], [ %inc89, %for.body63 ]
  Reused: {32,+,1}<nuw><nsw><%for.body63>
  Created: {33,+,1}<nuw><nsw><%for.body63>
Fetching: i16 33
  Reused: 33
B Invalidating:   %i58.010 = phi i16 [ 32, %vector.ph ], [ %inc89, %for.body63
] - {32,+,1}<nuw><nsw><%for.body63>
B Invalidating:   %inc89 = add nuw nsw i16 %i58.010, 1 -
{33,+,1}<nuw><nsw><%for.body63>
B Skipping:   %i58.010 = phi i16 [ 32, %vector.ph ], [ %inc89, %for.body63 ]
B Skipping:   %exitcond12.not = icmp eq i16 %inc89, 33
B Skipping:   br i1 %exitcond12.not, label %for.cond.cleanup62, label
%for.body63
  Created: {33,+,1}<nuw><nsw><%for.body63>

getBackedgeTakenInfo() will invalidate values in the loop when it first
computes BE counts. In this case, this happens while computing the SCEV for the
post-inc addrec. As a result, the post-inc addrec will be cached, without the
pre-inc addrec (corresponding to the loop header phi) being cached.

This goes against the basic assumption of my patch, that the loop header phi
will always have a cached value if there is a cached expression based on it.

I'll have to find some other way to solve my original motivation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210418/b743086f/attachment.html>


More information about the llvm-bugs mailing list