<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 failed: ((TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || TLI.isTypeLegal(Op.getValueType()) || Op.getOpcode() == ISD::TargetConstant) && "Unexpected illegal type!"), function LegalizeOp"
   href="https://llvm.org/bugs/show_bug.cgi?id=31672">31672</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: ((TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || TLI.isTypeLegal(Op.getValueType()) || Op.getOpcode() == ISD::TargetConstant) && "Unexpected illegal type!"), function LegalizeOp
          </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>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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This assertion has been encountered in <a href="https://bugs.freebsd.org/216166">https://bugs.freebsd.org/216166</a>, while
compiling gegl on i386.  It has been produced since at least trunk r281149, and
still reproduces as of trunk r291476.

Minimized test case in C:
------------------------------------------------------------------------
/* clang -cc1 -triple i386 -S -menable-unsafe-fp-math -ffast-math -target-cpu
i486 -target-feature +sse -O2 -w -vectorize-loops -vectorize-slp testcase.c */
x0, x1, x2;
float x3;
x4(float x5) {
  float x6 = x0 * x5, x7 = sqrtf(x6);
  return x7;
}
x8(int x5, double *x9) {
  int x10 = x4(x3 - x5);
  *x9 += x10;
}
x11() {
  do
    x8(x2, &x1);
  while (++x2);
}
------------------------------------------------------------------------

Minimized and simplified .ll:
------------------------------------------------------------------------
; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-48ce2a9.bc"
target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
target triple = "i386"

@x1 = external global i32, align 4

; Function Attrs: nounwind
define void @x11() local_unnamed_addr #0 {
entry:
  %0 = call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> zeroinitializer)
  %1 = fptosi <2 x float> %0 to <2 x i32>
  %2 = sitofp <2 x i32> %1 to <2 x double>
  %3 = fadd fast <2 x double> %2, zeroinitializer
  %bin.rdx = fadd fast <2 x double> %3, zeroinitializer
  %4 = extractelement <2 x double> %bin.rdx, i32 0
  store double %4, double* bitcast (i32* @x1 to double*), align 4, !tbaa !1
  ret void
}

; Function Attrs: nounwind readnone
declare <2 x float> @llvm.sqrt.v2f32(<2 x float>) #1

attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false"
"disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="i486"
"target-features"="+mmx,+sse,+x87" "unsafe-fp-math"="true"
"use-soft-float"="false" }
attributes #1 = { nounwind readnone }

!llvm.ident = !{!0}

!0 = !{!"FreeBSD clang version 4.0.0 (branches/release_40 292009) (based on
LLVM 4.0.0)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"double", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
------------------------------------------------------------------------</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>