<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 - test-suite/MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg.compile_time miscompiles for KNL target starting from r305960"
   href="https://bugs.llvm.org/show_bug.cgi?id=33554">33554</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>test-suite/MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg.compile_time miscompiles for KNL target starting from r305960
          </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>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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>elad2.cohen@intel.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=18687" name="attach_18687" title="reduced ll error reproducer">attachment 18687</a> <a href="attachment.cgi?id=18687&action=edit" title="reduced ll error reproducer">[details]</a></span>
reduced ll error reproducer

The test-suite tests:
MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg.compile_time
MultiSource/Benchmarks/MiBench/consumer-jpeg/consumer-jpeg.compile_time
miscompile for KNL target.
A git bisect pinned down r305960.

Reproducer on my machine:

"clang-5.0" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj"
"-disable-free" "-main-file-name" "jcdctmgr.c" "-mrelocation-model" "static"
"-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases"
"-munwind-tables" "-fuse-init-array" "-target-cpu" "knl"
"-momit-leaf-frame-pointer" "-dwarf-column-info" "-debugger-tuning=gdb"
"-coverage-notes-file"
"/SANDBOX/test-2017-06-22_07-37-42/MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/CMakeFiles/cjpeg.dir/jcdctmgr.c.gcno"
"-D" "NDEBUG" "-O3" "-Werror=date-time" "-w" "-ferror-limit" "19"
"-fmessage-length" "211" "-fobjc-runtime=gcc" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-vectorize-loops" "-vectorize-slp" "-x" "c"
"jcdctmgr-688225.c"

fatal error: error in backend: Cannot select: t1191: v16i32 = vselect t619,
t81, t409
  t619: v16i32 = bitcast t618
    t618: v8i64 = and t616, t617
      t616: v8i64 = bitcast t706
        t706: v16i32 = insert_subvector t705, t1070, Constant:i64<8>
          t705: v16i32 = insert_subvector undef:v16i32, t1074, Constant:i64<0>
            t704: v16i32 = undef
            t1074: v8i32 = insert_subvector t1073, t1079, Constant:i64<4>
              t1073: v8i32 = insert_subvector undef:v8i32, t1083,
Constant:i64<0>
                t1008: v8i32 = undef
                t1083: v4i32 = insert_vector_elt t1082, t723, Constant:i64<3>
                  t1082: v4i32 = insert_vector_elt t1081, t720, Constant:i64<2>



                  t723: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t721:1




                  t1025: i64 = Constant<3>
                t87: i64 = Constant<0>
              t1079: v4i32 = insert_vector_elt t1078, t735, Constant:i64<3>
                t1078: v4i32 = insert_vector_elt t1077, t732, Constant:i64<2>
                  t1077: v4i32 = insert_vector_elt t1076, t729, Constant:i64<1>



                  t732: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t730:1




                  t1023: i64 = Constant<2>
                t735: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t733:1
                  t24: i32 = Constant<0>
                  t469: i32 = Constant<-1>
                  t621: i8 = Constant<7>
                  t733: i32,i32 = X86ISD::SUB t950, t930


                t1025: i64 = Constant<3>
              t98: i64 = Constant<4>
            t87: i64 = Constant<0>
          t1070: v8i32 = insert_subvector t1069, t1087, Constant:i64<4>
            t1069: v8i32 = insert_subvector undef:v8i32, t1091, Constant:i64<0>
              t1008: v8i32 = undef
              t1091: v4i32 = insert_vector_elt t1090, t747, Constant:i64<3>
                t1090: v4i32 = insert_vector_elt t1089, t744, Constant:i64<2>
                  t1089: v4i32 = insert_vector_elt t1088, t741, Constant:i64<1>



                  t744: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t742:1




                  t1023: i64 = Constant<2>
                t747: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t745:1
                  t24: i32 = Constant<0>
                  t469: i32 = Constant<-1>
                  t621: i8 = Constant<7>
                  t745: i32,i32 = X86ISD::SUB t955, t935


                t1025: i64 = Constant<3>
              t87: i64 = Constant<0>
            t1087: v4i32 = insert_vector_elt t1086, t759, Constant:i64<3>
              t1086: v4i32 = insert_vector_elt t1085, t756, Constant:i64<2>
                t1085: v4i32 = insert_vector_elt t1084, t753, Constant:i64<1>
                  t1084: v4i32 = scalar_to_vector t750

                  t753: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t751:1




                  t1021: i64 = Constant<1>
                t756: i32,glue = X86ISD::CMOV Constant:i32<0>,
Constant:i32<-1>, Constant:i8<7>, t754:1
                  t24: i32 = Constant<0>
                  t469: i32 = Constant<-1>
                  t621: i8 = Constant<7>
                  t754: i32,i32 = X86ISD::SUB t959, t939


                t1023: i64 = Constant<2>
              t759: i32,glue = X86ISD::CMOV Constant:i32<0>, Constant:i32<-1>,
Constant:i8<7>, t757:1
                t24: i32 = Constant<0>
                t469: i32 = Constant<-1>
                t621: i8 = Constant<7>
                t757: i32,i32 = X86ISD::SUB t960, t940
                  t960: i32 = extract_vector_elt t956, Constant:i32<3>


                  t940: i32 = extract_vector_elt t936, Constant:i32<3>


              t1025: i64 = Constant<3>
            t98: i64 = Constant<4>
          t110: i64 = Constant<8>
      t617: v8i64 = bitcast t22
        t22: v16i32,ch = CopyFromReg t20:1, Register:v16i32 %vreg11
          t21: v16i32 = Register %vreg11
  t81: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
    t24: i32 = Constant<0>
  t409: v16i32 = sub t81, t31
    t81: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
      t24: i32 = Constant<0>
    t31: v16i32,ch = CopyFromReg t29:1, Register:v16i32 %vreg276
      t30: v16i32 = Register %vreg276
In function: forward_DCT



A reduced ll reproducer:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define void @forward_DCT() #0 {
  br i1 undef, label %10, label %1

; <label>:1:                                      ; preds = %0
  %2 = load <32 x i32>, <32 x i32>* undef, align 4, !tbaa !1
  %3 = icmp slt <32 x i32> undef, zeroinitializer
  %4 = icmp slt <32 x i32> undef, %2
  %5 = and <32 x i1> %4, %3
  %6 = select <32 x i1> %5, <32 x i32> zeroinitializer, <32 x i32> undef
  %7 = select <32 x i1> undef, <32 x i32> undef, <32 x i32> %6
  %8 = trunc <32 x i32> %7 to <32 x i16>
  %9 = select <32 x i1> undef, <32 x i16> zeroinitializer, <32 x i16> %8
  store <32 x i16> %9, <32 x i16>* undef, align 2, !tbaa !5
  unreachable

; <label>:10:                                     ; preds = %0
  ret void
}

attributes #0 = { nounwind uwtable
"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"="knl"
"target-features"="+adx,+aes,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+bmi2,+cx16,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prefetchwt1,+rdrnd,+rdseed,+rtm,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt"
"unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.ident = !{!0}

!0 = !{!"clang version 5.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
612cecf9e41fd6e4cee4ba49ad43c947055d17dc)"}
!1 = !{!2, !2, i64 0}
!2 = !{!"int", !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
!5 = !{!6, !6, i64 0}
!6 = !{!"short", !3, i64 0}


I've attached the above reduced reproducer and a before and after ll files.</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>