[llvm-bugs] [Bug 37727] New: LoopVectorize: different IR generation when debug info is present
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 7 00:28:15 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37727
Bug ID: 37727
Summary: LoopVectorize: different IR generation when debug info
is present
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: vsk at apple.com
CC: llvm-bugs at lists.llvm.org
Running `opt -loop-vectorize` on
test/Transforms/InstCombine/assume-redundant.ll produces different output
with/without debug info present. To reproduce the issue, do:
# Baseline
$ $OPT -instcombine test/Transforms/InstCombine/assume-redundant.ll -S -o -
# With debug info
$ $OPT -O1 test/Transforms/InstCombine/assume-redundant.ll -o - -debugify-each
-debugify-quiet | $OPT -strip -S
Here's the diff I see. The divergence appears to start with a failure to
eliminate a ptrtoint-of-undef:
Comparing: -loop-vectorize test/Transforms/InstCombine/assume-redundant.ll
Baseline: /var/folders/j8/t4w0bp8j6x1g6fpghkcb4sjm0000gp/T/tmp.G6IDKish
With DI : /var/folders/j8/t4w0bp8j6x1g6fpghkcb4sjm0000gp/T/tmp.BR4dAaBb
13,109c13,110
< %5 = and i64 %4, 31
< %6 = icmp eq i64 %5, 0
< br i1 false, label %59, label %7
<
< ; <label>:7: ; preds = %1
< %8 = getelementptr double, double* %3, i64 1
< %9 = ptrtoint double* %8 to i64
< %10 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 16, i64 799)
< %11 = extractvalue { i64, i1 } %10, 0
< %12 = extractvalue { i64, i1 } %10, 1
< %13 = add i64 %9, %11
< %14 = sub i64 %9, %11
< %15 = icmp ugt i64 %14, %9
< %16 = icmp ult i64 %13, %9
< %17 = select i1 false, i1 %15, i1 %16
< %18 = or i1 %17, %12
< %19 = or i1 false, %18
< %20 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 16, i64 799)
< %21 = extractvalue { i64, i1 } %20, 0
< %22 = extractvalue { i64, i1 } %20, 1
< %23 = add i64 %4, %21
< %24 = sub i64 %4, %21
< %25 = icmp ugt i64 %24, %4
< %26 = icmp ult i64 %23, %4
< %27 = select i1 false, i1 %25, i1 %26
< %28 = or i1 %27, %22
< %29 = or i1 %19, %28
< br i1 %29, label %59, label %30
<
< ; <label>:30: ; preds = %7
< br label %31
<
< ; <label>:31: ; preds = %31, %30
< %32 = phi i64 [ 0, %30 ], [ %54, %31 ]
< %33 = phi <2 x i64> [ <i64 0, i64 2>, %30 ], [ %55, %31 ]
< %34 = shl i64 %32, 1
< %35 = add i64 %34, 0
< %36 = add i64 %34, 2
< tail call void @llvm.assume(i1 %6)
< tail call void @llvm.assume(i1 %6)
< %37 = getelementptr inbounds double, double* %3, i64 %35
< %38 = getelementptr inbounds double, double* %37, i32 0
< %39 = bitcast double* %38 to <4 x double>*
< %40 = load <4 x double>, <4 x double>* %39, align 8
< %41 = shufflevector <4 x double> %40, <4 x double> undef, <2 x i32> <i32 0,
i32 2>
< %42 = shufflevector <4 x double> %40, <4 x double> undef, <2 x i32> <i32 1,
i32 3>
< %43 = fadd <2 x double> %41, <double 1.000000e+00, double 1.000000e+00>
< tail call void @llvm.assume(i1 %6)
< tail call void @llvm.assume(i1 %6)
< %44 = fmul <2 x double> %43, <double 2.000000e+00, double 2.000000e+00>
< %45 = add nuw nsw <2 x i64> %33, <i64 1, i64 1>
< tail call void @llvm.assume(i1 %6)
< tail call void @llvm.assume(i1 %6)
< %46 = extractelement <2 x i64> %45, i32 0
< %47 = getelementptr inbounds double, double* %3, i64 %46
< %48 = fadd <2 x double> %42, <double 1.000000e+00, double 1.000000e+00>
< tail call void @llvm.assume(i1 %6)
< tail call void @llvm.assume(i1 %6)
< %49 = fmul <2 x double> %48, <double 2.000000e+00, double 2.000000e+00>
< %50 = getelementptr inbounds double, double* %47, i32 -1
< %51 = bitcast double* %50 to <4 x double>*
< %52 = shufflevector <2 x double> %44, <2 x double> %49, <4 x i32> <i32 0,
i32 1, i32 2, i32 3>
< %53 = shufflevector <4 x double> %52, <4 x double> undef, <4 x i32> <i32 0,
i32 2, i32 1, i32 3>
< store <4 x double> %53, <4 x double>* %51, align 8
< %54 = add i64 %32, 2
< %55 = add <2 x i64> %33, <i64 4, i64 4>
< %56 = icmp eq i64 %54, 800
< br i1 %56, label %57, label %31, !llvm.loop !0
<
< ; <label>:57: ; preds = %31
< %58 = icmp eq i64 800, 800
< br i1 %58, label %74, label %59
<
< ; <label>:59: ; preds = %57, %7, %1
< %60 = phi i64 [ 1600, %57 ], [ 0, %1 ], [ 0, %7 ]
< br label %61
<
< ; <label>:61: ; preds = %61, %59
< %62 = phi i64 [ %60, %59 ], [ %72, %61 ]
< tail call void @llvm.assume(i1 %6)
< %63 = getelementptr inbounds double, double* %3, i64 %62
< %64 = load double, double* %63, align 16
< %65 = fadd double %64, 1.000000e+00
< tail call void @llvm.assume(i1 %6)
< %66 = fmul double %65, 2.000000e+00
< store double %66, double* %63, align 16
< %67 = add nuw nsw i64 %62, 1
< tail call void @llvm.assume(i1 %6)
< %68 = getelementptr inbounds double, double* %3, i64 %67
< %69 = load double, double* %68, align 8
< %70 = fadd double %69, 1.000000e+00
< tail call void @llvm.assume(i1 %6)
< %71 = fmul double %70, 2.000000e+00
< store double %71, double* %68, align 8
< %72 = add nuw nsw i64 %67, 1
< %73 = icmp eq i64 %67, 1599
< br i1 %73, label %74, label %61, !llvm.loop !2
---
> %5 = ptrtoint double* undef to i64
> %6 = and i64 %4, 31
> %7 = icmp eq i64 %6, 0
> br i1 false, label %60, label %8
>
> ; <label>:8: ; preds = %1
> %9 = getelementptr double, double* %3, i64 1
> %10 = ptrtoint double* %9 to i64
> %11 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 16, i64 799)
> %12 = extractvalue { i64, i1 } %11, 0
> %13 = extractvalue { i64, i1 } %11, 1
> %14 = add i64 %10, %12
> %15 = sub i64 %10, %12
> %16 = icmp ugt i64 %15, %10
> %17 = icmp ult i64 %14, %10
> %18 = select i1 false, i1 %16, i1 %17
> %19 = or i1 %18, %13
> %20 = or i1 false, %19
> %21 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 16, i64 799)
> %22 = extractvalue { i64, i1 } %21, 0
> %23 = extractvalue { i64, i1 } %21, 1
> %24 = add i64 %4, %22
> %25 = sub i64 %4, %22
> %26 = icmp ugt i64 %25, %4
> %27 = icmp ult i64 %24, %4
> %28 = select i1 false, i1 %26, i1 %27
> %29 = or i1 %28, %23
> %30 = or i1 %20, %29
> br i1 %30, label %60, label %31
>
> ; <label>:31: ; preds = %8
> br label %32
>
> ; <label>:32: ; preds = %32, %31
> %33 = phi i64 [ 0, %31 ], [ %55, %32 ]
> %34 = phi <2 x i64> [ <i64 0, i64 2>, %31 ], [ %56, %32 ]
> %35 = shl i64 %33, 1
> %36 = add i64 %35, 0
> %37 = add i64 %35, 2
> tail call void @llvm.assume(i1 %7)
> tail call void @llvm.assume(i1 %7)
> %38 = getelementptr inbounds double, double* %3, i64 %36
> %39 = getelementptr inbounds double, double* %38, i32 0
> %40 = bitcast double* %39 to <4 x double>*
> %41 = load <4 x double>, <4 x double>* %40, align 8
> %42 = shufflevector <4 x double> %41, <4 x double> undef, <2 x i32> <i32 0, i32 2>
> %43 = shufflevector <4 x double> %41, <4 x double> undef, <2 x i32> <i32 1, i32 3>
> %44 = fadd <2 x double> %42, <double 1.000000e+00, double 1.000000e+00>
> tail call void @llvm.assume(i1 %7)
> tail call void @llvm.assume(i1 %7)
> %45 = fmul <2 x double> %44, <double 2.000000e+00, double 2.000000e+00>
> %46 = add nuw nsw <2 x i64> %34, <i64 1, i64 1>
> tail call void @llvm.assume(i1 %7)
> tail call void @llvm.assume(i1 %7)
> %47 = extractelement <2 x i64> %46, i32 0
> %48 = getelementptr inbounds double, double* %3, i64 %47
> %49 = fadd <2 x double> %43, <double 1.000000e+00, double 1.000000e+00>
> tail call void @llvm.assume(i1 %7)
> tail call void @llvm.assume(i1 %7)
> %50 = fmul <2 x double> %49, <double 2.000000e+00, double 2.000000e+00>
> %51 = getelementptr inbounds double, double* %48, i32 -1
> %52 = bitcast double* %51 to <4 x double>*
> %53 = shufflevector <2 x double> %45, <2 x double> %50, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
> %54 = shufflevector <4 x double> %53, <4 x double> undef, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
> store <4 x double> %54, <4 x double>* %52, align 8
> %55 = add i64 %33, 2
> %56 = add <2 x i64> %34, <i64 4, i64 4>
> %57 = icmp eq i64 %55, 800
> br i1 %57, label %58, label %32, !llvm.loop !0
>
> ; <label>:58: ; preds = %32
> %59 = icmp eq i64 800, 800
> br i1 %59, label %75, label %60
>
> ; <label>:60: ; preds = %58, %8, %1
> %61 = phi i64 [ 1600, %58 ], [ 0, %1 ], [ 0, %8 ]
> br label %62
>
> ; <label>:62: ; preds = %62, %60
> %63 = phi i64 [ %61, %60 ], [ %73, %62 ]
> tail call void @llvm.assume(i1 %7)
> %64 = getelementptr inbounds double, double* %3, i64 %63
> %65 = load double, double* %64, align 16
> %66 = fadd double %65, 1.000000e+00
> tail call void @llvm.assume(i1 %7)
> %67 = fmul double %66, 2.000000e+00
> store double %67, double* %64, align 16
> %68 = add nuw nsw i64 %63, 1
> tail call void @llvm.assume(i1 %7)
> %69 = getelementptr inbounds double, double* %3, i64 %68
> %70 = load double, double* %69, align 8
> %71 = fadd double %70, 1.000000e+00
> tail call void @llvm.assume(i1 %7)
> %72 = fmul double %71, 2.000000e+00
> store double %72, double* %69, align 8
> %73 = add nuw nsw i64 %68, 1
> %74 = icmp eq i64 %68, 1599
> br i1 %74, label %75, label %62, !llvm.loop !2
111c112
< ; <label>:74: ; preds = %57, %61
---
> ; <label>:75: ; preds = %58, %62
:: Found a test case ^
--
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/20180607/164d4019/attachment.html>
More information about the llvm-bugs
mailing list