<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - opt crash with "-mem2reg -lcssa -loop-rotate" Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Requested to preserve LCSSA, but it's already broken."' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=48871">48871</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crash with "-mem2reg -lcssa -loop-rotate" Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Requested to preserve LCSSA, but it's already broken."' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>suochenyao@163.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24416" name="attach_24416" title="IR that is passed to opt">attachment 24416</a> <a href="attachment.cgi?id=24416&action=edit" title="IR that is passed to opt">[details]</a></span>
IR that is passed to opt

*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
char c=0;
char a=0;
short b=0;
int d=0;
char e() {
  long f;
  for (; 1;)
    for (;;) {
      char g;
      if (b)
        break;
      f = c;
    }
  for (; 0;) {
    int h;
    f & 0;
    for (; 0; 1)
      return d;
  }
  if (a)
    for (; 0;)
      for (; 0; 0)
        return 0;
}
int main() {}
*******************************************************************************
clang version:
$ clang -v
clang version 10.0.0 (/home/suocy/src/llvm-dev/llvm/tools/clang
65acf43270ea2894dffa0d0b292b92402f80c8cb) (/home/suocy/src/llvm-dev/llvm
2c4ca6832fa6b306ee6a7010bfb80a3f2596f824)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
Found candidate GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
*******************************************************************************
Command Lines:
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc
a.c:16:7: warning: expression result unused [-Wunused-value]
    f & 0;
    ~ ^ ~
a.c:17:15: warning: expression result unused [-Wunused-value]
    for (; 0; 1)
              ^
a.c:22:17: warning: expression result unused [-Wunused-value]
      for (; 0; 0)
                ^
3 warnings generated.
$ opt -mem2reg -lcssa -loop-rotate a.bc -o a.opt.bc
opt: /home/suocy/src/llvm-dev/llvm/lib/Transforms/Utils/LoopSimplify.cpp:721:
bool llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*,
llvm::ScalarEvolution*, llvm::AssumptionCache*, llvm::MemorySSAUpdater*, bool):
Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Requested to preserve LCSSA,
but it's already broken."' failed.
Stack dump:
0.      Program arguments: /home/suocy/bin/llvm-dev/bin/opt -mem2reg -lcssa
-loop-rotate a.bc -o a.opt.bc
1.      Running pass 'Function Pass Manager' on module 'a.bc'.
2.      Running pass 'Canonicalize natural loops' on function '@e'
 #0 0x0000000002686b9a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/suocy/bin/llvm-dev/bin/opt+0x2686b9a)
 #1 0x0000000002684ae4 llvm::sys::RunSignalHandlers()
(/home/suocy/bin/llvm-dev/bin/opt+0x2684ae4)
 #2 0x0000000002684c12 SignalHandler(int)
(/home/suocy/bin/llvm-dev/bin/opt+0x2684c12)
 #3 0x00007fe665b32630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #4 0x00007fe664720387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007fe664721a78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007fe6647191a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007fe664719252 (/lib64/libc.so.6+0x2f252)
 #8 0x000000000271d2dd llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*,
llvm::MemorySSAUpdater*, bool) (/home/suocy/bin/llvm-dev/bin/opt+0x271d2dd)
 #9 0x000000000271d55d (anonymous
namespace)::LoopSimplify::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x271d55d)
#10 0x0000000001fd0011 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x1fd0011)
#11 0x0000000001fd0979 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x1fd0979)
#12 0x0000000001fcf2ee llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x1fcf2ee)
#13 0x00000000007dca14 main (/home/suocy/bin/llvm-dev/bin/opt+0x7dca14)
#14 0x00007fe66470c555 __libc_start_main (/lib64/libc.so.6+0x22555)
#15 0x0000000000860d15 _start (/home/suocy/bin/llvm-dev/bin/opt+0x860d15)
Aborted</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>