<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 - Assertion `Get(To) == To && "Replacement PHI node is already replaced."' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=41052">41052</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `Get(To) == To && "Replacement PHI node is already replaced."' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jesper.antonsson@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21590" name="attach_21590" title="reproducer for the assert">attachment 21590</a> <a href="attachment.cgi?id=21590&action=edit" title="reproducer for the assert">[details]</a></span>
reproducer for the assert

This assertion in CodeGenPrepare was hit from a Csmith generate. It involves
trying to optimize a store instruction in a dead basic block. Reduced mir test
attached.

-> build-all/bin/llc -run-pass=codegenprepare -o -
codegen-prepare-replacephi.mir 
llc: ../lib/CodeGen/CodeGenPrepare.cpp:2879: void (anonymous
namespace)::SimplificationTracker::ReplacePhi(llvm::PHINode *, llvm::PHINode
*): Assertion `Get(To) == To && "Replacement PHI node is already replaced."'
failed.
Stack dump:
0.      Program arguments: build-all/bin/llc -run-pass=codegenprepare -o -
codegen-prepare-replacephi.mir 
1.      Running pass 'Function Pass Manager' on module
'codegen-prepare-replacephi.mir'.
2.      Running pass 'CodeGen Prepare' on function '@f1'
 #0 0x00000000022a9824 PrintStackTraceSignalHandler(void*)
(build-all/bin/llc+0x22a9824)
 #1 0x00000000022a73f0 llvm::sys::RunSignalHandlers()
(build-all/bin/llc+0x22a73f0)
 #2 0x00000000022a9c68 SignalHandler(int) (build-all/bin/llc+0x22a9c68)
 #3 0x00007f25650ae390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00007f2563c18428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #5 0x00007f2563c1a02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
 #6 0x00007f2563c10bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
 #7 0x00007f2563c10c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
 #8 0x00000000017ec352 (anonymous
namespace)::AddressingModeCombiner::combineAddrModes()
(build-all/bin/llc+0x17ec352)
 #9 0x00000000017de2b0 (anonymous
namespace)::CodeGenPrepare::optimizeMemoryInst(llvm::Instruction*,
llvm::Value*, llvm::Type*, unsigned int) (build-all/bin/llc+0x17de2b0)
#10 0x00000000017d50f8 (anonymous
namespace)::CodeGenPrepare::optimizeInst(llvm::Instruction*, bool&)
(build-all/bin/llc+0x17d50f8)
#11 0x00000000017ce2c0 (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&)
(build-all/bin/llc+0x17ce2c0)
#12 0x0000000001c41dab llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all/bin/llc+0x1c41dab)
#13 0x0000000001c42063 llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all/bin/llc+0x1c42063)
#14 0x0000000001c4265f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/llc+0x1c4265f)
#15 0x000000000073d3a7 compileModule(char**, llvm::LLVMContext&)
(build-all/bin/llc+0x73d3a7)
#16 0x000000000073a9e0 main (build-all/bin/llc+0x73a9e0)
#17 0x00007f2563c03830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#18 0x0000000000738bf9 _start (build-all/bin/llc+0x738bf9)
Aborted (core dumped)</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>