[llvm-bugs] [Bug 35579] New: [x86] hang while lowering vector mul/shl
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Dec 8 06:28:15 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35579
Bug ID: 35579
Summary: [x86] hang while lowering vector mul/shl
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
As first noted in the llvm-commits thread for r318323, the example below hangs
with:
$ ./llc -o - inf.ll
.text
.file "inf.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64--linux-gnu"
%struct.c = type { i32, [0 x i8] }
@d = common local_unnamed_addr global i32 0, align 4
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void
()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* null }]
@__msan_retval_tls = external thread_local(initialexec) global [100 x i64]
@__msan_retval_origin_tls = external thread_local(initialexec) global i32
@__msan_param_tls = external thread_local(initialexec) global [100 x i64]
@__msan_param_origin_tls = external thread_local(initialexec) global [200 x
i32]
@__msan_va_arg_tls = external thread_local(initialexec) global [100 x i64]
@__msan_va_arg_overflow_size_tls = external thread_local(initialexec) global
i64
@__msan_origin_tls = external thread_local(initialexec) global i32
; Function Attrs: norecurse nounwind sanitize_memory
define i32 @e(%struct.c* %f) local_unnamed_addr #0 {
entry:
%0 = load i64, i64* getelementptr inbounds ([100 x i64], [100 x i64]*
@__msan_param_tls, i64 0, i64 0), align 8
%1 = ptrtoint %struct.c* %f to i64
%_msprop = trunc i64 %0 to i32
%2 = trunc i64 %1 to i32
store i32 0, i32* inttoptr (i64 xor (i64 ptrtoint (i32* @d to i64), i64
87960930222080) to i32*), align 4
store i32 0, i32* @d, align 4, !tbaa !2
%3 = icmp eq i32 %_msprop, 0
br i1 %3, label %5, label %4, !prof !6
; <label>:4: ; preds = %entry
call void @__msan_warning_noreturn() #1
call void asm sideeffect "", ""() #1
unreachable
; <label>:5: ; preds = %entry
%cmp9 = icmp sgt i32 %2, 0
br i1 %cmp9, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %5
%_msprop23 = trunc i64 %0 to i8
%6 = trunc i64 %1 to i8
%arrayidx.phi.trans.insert = getelementptr inbounds %struct.c, %struct.c* %f,
i64 0, i32 1, i64 0
%_mscmp54 = icmp eq i64 %0, 0
br i1 %_mscmp54, label %8, label %7, !prof !6
; <label>:7: ; preds = %for.body.lr.ph
call void @__msan_warning_noreturn() #1
call void asm sideeffect "", ""() #1
unreachable
; <label>:8: ; preds = %for.body.lr.ph
%.pre = load i8, i8* %arrayidx.phi.trans.insert, align 1, !tbaa !7
%9 = ptrtoint i8* %arrayidx.phi.trans.insert to i64
%10 = xor i64 %9, 87960930222080
%11 = inttoptr i64 %10 to i8*
%_msld = load i8, i8* %11, align 1
%wide.trip.count = and i64 %1, 4294967295
br i1 false, label %12, label %13, !prof !8
; <label>:12: ; preds = %8
unreachable
; <label>:13: ; preds = %8
%14 = icmp ult i64 %wide.trip.count, 32
br i1 %14, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %13
%n.mod.vf = and i64 %1, 31
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
%cast.crd = trunc i64 %n.vec to i8
%15 = mul i8 %cast.crd, %6
%_msprop33 = or i8 %_msld, %_msprop23
%ind.end = add i8 %.pre, %15
%_msprop34 = insertelement <16 x i8> undef, i8 %_msld, i32 0
%.splatinsert = insertelement <16 x i8> undef, i8 %.pre, i32 0
%_msprop35 = shufflevector <16 x i8> %_msprop34, <16 x i8> undef, <16 x i32>
zeroinitializer
%.splat = shufflevector <16 x i8> %.splatinsert, <16 x i8> undef, <16 x i32>
zeroinitializer
%_msprop36 = insertelement <16 x i8> undef, i8 %_msprop23, i32 0
%.splatinsert12 = insertelement <16 x i8> undef, i8 %6, i32 0
%_msprop37 = shufflevector <16 x i8> %_msprop36, <16 x i8> undef, <16 x i32>
zeroinitializer
%.splat13 = shufflevector <16 x i8> %.splatinsert12, <16 x i8> undef, <16 x
i32> zeroinitializer
%msprop_mul_cst = mul <16 x i8> %_msprop37, <i8 0, i8 1, i8 2, i8 1, i8 4, i8
1, i8 2, i8 1, i8 8, i8 1, i8 2, i8 1, i8 4, i8 1, i8 2, i8 1>
%16 = mul <16 x i8> %.splat13, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8
7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
%_msprop38 = or <16 x i8> %_msprop35, %msprop_mul_cst
%induction = add <16 x i8> %.splat, %16
%17 = shl i8 %_msprop23, 4
%18 = shl i8 %6, 4
%_msprop39 = insertelement <16 x i8> undef, i8 %17, i32 0
%.splatinsert14 = insertelement <16 x i8> undef, i8 %18, i32 0
%_msprop40 = shufflevector <16 x i8> %_msprop39, <16 x i8> undef, <16 x i32>
zeroinitializer
%.splat15 = shufflevector <16 x i8> %.splatinsert14, <16 x i8> undef, <16 x
i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %37, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %37 ]
%_msphi_s46 = phi <16 x i8> [ %_msprop38, %vector.ph ], [ %_msprop47, %37 ]
%vec.ind = phi <16 x i8> [ %induction, %vector.ph ], [ %vec.ind.next, %37 ]
%_msprop47 = or <16 x i8> %_msphi_s46, %_msprop40
%step.add = add <16 x i8> %vec.ind, %.splat15
%_msprop49 = or <16 x i8> %_msprop47, %_msprop37
%19 = add <16 x i8> %step.add, %.splat13
%20 = or i64 %index, 1
%21 = getelementptr inbounds %struct.c, %struct.c* %f, i64 0, i32 1, i64 %20
br i1 false, label %22, label %23, !prof !8
; <label>:22: ; preds = %vector.body
unreachable
; <label>:23: ; preds = %vector.body
%24 = ptrtoint i8* %21 to i64
%25 = xor i64 %24, 87960930222080
%26 = inttoptr i64 %25 to <16 x i8>*
%27 = bitcast i8* %21 to <16 x i8>*
%28 = add <16 x i8> %vec.ind, %.splat13
%_msprop48 = or <16 x i8> %_msphi_s46, %_msprop37
store <16 x i8> %_msprop48, <16 x i8>* %26, align 1
store <16 x i8> %28, <16 x i8>* %27, align 1, !tbaa !7
%29 = getelementptr i8, i8* %21, i64 16
br i1 false, label %30, label %31, !prof !8
; <label>:30: ; preds = %23
unreachable
; <label>:31: ; preds = %23
%32 = ptrtoint i8* %29 to i64
%33 = xor i64 %32, 87960930222080
%34 = inttoptr i64 %33 to <16 x i8>*
%35 = bitcast i8* %29 to <16 x i8>*
store <16 x i8> %_msprop49, <16 x i8>* %34, align 1
store <16 x i8> %19, <16 x i8>* %35, align 1, !tbaa !7
%index.next = add i64 %index, 32
br i1 false, label %36, label %37, !prof !8
; <label>:36: ; preds = %31
unreachable
; <label>:37: ; preds = %31
%38 = icmp eq i64 %index.next, %n.vec
%vec.ind.next = add <16 x i8> %step.add, %.splat15
br i1 %38, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %37
br i1 false, label %39, label %40, !prof !8
; <label>:39: ; preds = %middle.block
unreachable
; <label>:40: ; preds = %middle.block
%41 = icmp eq i64 %n.mod.vf, 0
br i1 %41, label %for.cond.for.end_crit_edge, label %for.body.preheader
for.body.preheader: ; preds = %40, %13
%_msphi_s = phi i8 [ %_msld, %13 ], [ %_msprop33, %40 ]
%.ph = phi i8 [ %.pre, %13 ], [ %ind.end, %40 ]
%indvars.iv.ph = phi i64 [ 0, %13 ], [ %n.vec, %40 ]
br label %for.body
for.body: ; preds =
%for.body.preheader, %49
%_msphi_s25 = phi i8 [ %_msprop27, %49 ], [ %_msphi_s, %for.body.preheader ]
%42 = phi i8 [ %conv1, %49 ], [ %.ph, %for.body.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %49 ], [ %indvars.iv.ph,
%for.body.preheader ]
%_msprop27 = or i8 %_msphi_s25, %_msprop23
%conv1 = add i8 %42, %6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx5 = getelementptr inbounds %struct.c, %struct.c* %f, i64 0, i32 1,
i64 %indvars.iv.next
br i1 false, label %43, label %44, !prof !8
; <label>:43: ; preds = %for.body
unreachable
; <label>:44: ; preds = %for.body
%45 = ptrtoint i8* %arrayidx5 to i64
%46 = xor i64 %45, 87960930222080
%47 = inttoptr i64 %46 to i8*
store i8 %_msprop27, i8* %47, align 1
store i8 %conv1, i8* %arrayidx5, align 1, !tbaa !7
br i1 false, label %48, label %49, !prof !8
; <label>:48: ; preds = %44
unreachable
; <label>:49: ; preds = %44
%exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond, label %for.cond.for.end_crit_edge.loopexit, label %for.body,
!llvm.loop !11
for.cond.for.end_crit_edge.loopexit: ; preds = %49
br label %for.cond.for.end_crit_edge
for.cond.for.end_crit_edge: ; preds =
%for.cond.for.end_crit_edge.loopexit, %40
store i32 0, i32* inttoptr (i64 xor (i64 ptrtoint (i32* @d to i64), i64
87960930222080) to i32*), align 4
store i32 %2, i32* @d, align 4, !tbaa !2
br label %for.end
for.end: ; preds =
%for.cond.for.end_crit_edge, %5
store i32 -1, i32* bitcast ([100 x i64]* @__msan_retval_tls to i32*), align 8
ret i32 undef
}
declare void @__msan_init() local_unnamed_addr
define internal void @msan.module_ctor() {
tail call void @__msan_init()
ret void
}
declare void @__msan_warning_noreturn()
declare void @__msan_maybe_warning_1(i8, i32)
declare void @__msan_maybe_store_origin_1(i8, i8*, i32)
declare void @__msan_maybe_warning_2(i16, i32)
declare void @__msan_maybe_store_origin_2(i16, i8*, i32)
declare void @__msan_maybe_warning_4(i32, i32)
declare void @__msan_maybe_store_origin_4(i32, i8*, i32)
declare void @__msan_maybe_warning_8(i64, i32)
declare void @__msan_maybe_store_origin_8(i64, i8*, i32)
declare void @__msan_set_alloca_origin4(i8*, i64, i8*, i64)
declare void @__msan_poison_stack(i8*, i64)
declare i32 @__msan_chain_origin(i32)
declare i8* @__msan_memmove(i8*, i8*, i64)
declare i8* @__msan_memcpy(i8*, i8*, i64)
declare i8* @__msan_memset(i8*, i32, i64)
attributes #0 = { norecurse nounwind sanitize_memory
"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-features"="+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87"
"unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 6.0.0 (trunk 320064) (llvm/trunk 320063)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"int", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}
!6 = !{!"branch_weights", i32 1000, i32 1}
!7 = !{!4, !4, i64 0}
!8 = !{!"branch_weights", i32 1, i32 1000}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = distinct !{!11, !12, !10}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171208/7be8e71c/attachment.html>
More information about the llvm-bugs
mailing list