<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 -deadargelim -simplifycfg -inline -sroa -early-cse-memssa -jump-threading -instcombine" at "Combine redundant instructions""
   href="https://bugs.llvm.org/show_bug.cgi?id=48369">48369</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crash with "-mem2reg -deadargelim -simplifycfg -inline -sroa -early-cse-memssa -jump-threading -instcombine" at "Combine redundant instructions"
          </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>Windows NT
          </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=24230" name="attach_24230" title="bc file">attachment 24230</a> <a href="attachment.cgi?id=24230&action=edit" title="bc file">[details]</a></span>
bc file

*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
$ cat a.c
short a=0;
int b=0, d=0, f=0;
long c=0;
char e=0;
int main() {
  int g = 3;
  for (; a;) {
    int h = 0;
    for (;; d) {
      c = (h <= 0) << 8;
      h = b;
      for (; g;)
        ;
      for (; f;)
        for (; e;)
          ;
    }
  }
  return 0;
}
*******************************************************************************
clang version:
$ clang --version
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang
e52a91e156d7ab26989fef526434b02514428c91)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
*******************************************************************************
Command Lines:
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc
a.c:9:13: warning: expression result unused [-Wunused-value]
    for (;; d) {
            ^
1 warning generated.
$ opt -mem2reg -deadargelim -simplifycfg -inline -sroa -early-cse-memssa
-jump-threading -instcombine a.bc -o a.opt.bc
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: /home/suocy/bin/llvm-dev/bin/opt -mem2reg
-deadargelim -simplifycfg -inline -sroa -early-cse-memssa -jump-threading
-instcombine a.bc -o a.opt.bc
1.      Running pass 'CallGraph Pass Manager' on module 'a.bc'.
2.      Running pass 'Combine redundant instructions' on function '@main'
 #0 0x0000000002a8136c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/suocy/bin/llvm-dev/bin/opt+0x2a8136c)
 #1 0x0000000002a7f1e4 llvm::sys::RunSignalHandlers()
(/home/suocy/bin/llvm-dev/bin/opt+0x2a7f1e4)
 #2 0x0000000002a7f343 SignalHandler(int)
(/home/suocy/bin/llvm-dev/bin/opt+0x2a7f343)
 #3 0x00007fec2e9b4630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #4 0x0000000002584f5e
llvm::InstCombinerImpl::visitSelectInst(llvm::SelectInst&)
(/home/suocy/bin/llvm-dev/bin/opt+0x2584f5e)
 #5 0x00000000024f310a llvm::InstCombinerImpl::run()
(/home/suocy/bin/llvm-dev/bin/opt+0x24f310a)
 #6 0x00000000024f4d29 combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*,
llvm::ProfileSummaryInfo*, unsigned int, llvm::LoopInfo*)
(/home/suocy/bin/llvm-dev/bin/opt+0x24f4d29)
 #7 0x00000000024f698a
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x24f698a)
 #8 0x00000000022bf598 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x22bf598)
 #9 0x0000000001a304f4 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x1a304f4)
#10 0x00000000022bee43 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x22bee43)
#11 0x000000000072c61b main (/home/suocy/bin/llvm-dev/bin/opt+0x72c61b)
#12 0x00007fec2d58e555 __libc_start_main (/lib64/libc.so.6+0x22555)
#13 0x00000000007ddac5 _start (/home/suocy/bin/llvm-dev/bin/opt+0x7ddac5)
Segmentation fault</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>