<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 - Invalid PPC CTR loop with 128bit integers"
   href="https://bugs.llvm.org/show_bug.cgi?id=32485">32485</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid PPC CTR loop with 128bit integers
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mail@timnn.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiling the below IR with llc -O1 (Debug Assertions enabled, affects at least
LLVM 4.0 & Master) triggers an unreachable:

```
Invalid PPC CTR loop!
UNREACHABLE executed at
/home/logic/build-tmp/llvm-master/src/lib/Target/PowerPC/PPCCTRLoops.cpp:722!

[...]

0.      Program arguments: ../../../../../llvm-master/build/bin/llc -O1
core.red-4.ll
1.      Running pass 'Function Pass Manager' on module 'core.red-4.ll'.
2.      Running pass 'PowerPC CTR Loops Verify' on function '@_Crash_Fn'
```

IR:

```
; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-7eb0c3b.bc"
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"

; Function Attrs: uwtable
define fastcc void @_Crash_Fn() unnamed_addr #0 {
entry-block:
  br label %_Label_0

_Label_0:                                         ; preds = %_Label_0,
%entry-block
  %result.0138 = phi i128 [ %5, %_Label_0 ], [ 0, %entry-block ]
  %iter.sroa.0.0137 = phi i8* [ %0, %_Label_0 ], [ undef, %entry-block ]
  %0 = getelementptr inbounds i8, i8* %iter.sroa.0.0137, i64 1
  %1 = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %result.0138,
i128 undef) #2
  %2 = extractvalue { i128, i1 } %1, 0
  %3 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %2, i128 0) #2
  %4 = extractvalue { i128, i1 } %3, 1
  %5 = extractvalue { i128, i1 } %3, 0
  %6 = icmp eq i8* %0, null
  br i1 %6, label %bb66.loopexit, label %_Label_0

bb66.loopexit:                                    ; preds = %_Label_0
  unreachable
}

; Function Attrs: nounwind readnone
declare { i128, i1 } @llvm.sadd.with.overflow.i128(i128, i128) #1

; Function Attrs: nounwind readnone
declare { i128, i1 } @llvm.smul.with.overflow.i128(i128, i128) #1

attributes #0 = { uwtable }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind }
```</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>