Re: [llvm] 8e67982 - [NewGVN] Add test cases for remaining known issues.

David Zarzycki via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 03:39:13 PDT 2020


Hi Florian,

This seems to have exposed a latent bug. In particular, llvm/test/Transforms/NewGVN/todo-pr37121-seens-this-value-a-lot.ll spins out of control until the test times out as `opt` consumes hundreds of gigabytes of RAM.

My setup: `opt` built release+no-assert via Fedora's build of clang-10 on Fedora 32 *(x86-64).

I don't want to ask to revert the test since it's exposing a bug and I can tell my CI setup to ignore that test. That being said, this seems really concerning. Is anybody looking into this?

Dave



On Tue, Jul 28, 2020, at 3:37 PM, Florian Hahn via llvm-commits wrote:
> 
> Author: Florian Hahn
> Date: 2020-07-28T20:33:04+01:00
> New Revision: 8e67982384d4a11892c04d16c2d10d7533e56094
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/8e67982384d4a11892c04d16c2d10d7533e56094
> DIFF: 
> https://github.com/llvm/llvm-project/commit/8e67982384d4a11892c04d16c2d10d7533e56094.diff
> 
> LOG: [NewGVN] Add test cases for remaining known issues.
> 
> This patch adds IR tests for the known NewGVN issues. The intention is
> that adding them now will make it easier to keep track of fixes.
> 
> Added: 
>     llvm/test/Transforms/NewGVN/todo-pr33165-distribute-undef.ll
>     llvm/test/Transforms/NewGVN/todo-pr35074-phi-of-ops.ll
>     llvm/test/Transforms/NewGVN/todo-pr36335-phi-undef.ll
>     llvm/test/Transforms/NewGVN/todo-pr37121-seens-this-value-a-lot.ll
>     llvm/test/Transforms/NewGVN/todo-pr42422-phi-of-ops.ll
> 
> Modified: 
>     
> 
> Removed: 
>     
> 
> 
> ################################################################################
> diff  --git 
> a/llvm/test/Transforms/NewGVN/todo-pr33165-distribute-undef.ll 
> b/llvm/test/Transforms/NewGVN/todo-pr33165-distribute-undef.ll
> new file mode 100644
> index 0000000000000..0a9255c448e56
> --- /dev/null
> +++ b/llvm/test/Transforms/NewGVN/todo-pr33165-distribute-undef.ll
> @@ -0,0 +1,17 @@
> +; NOTE: Assertions have been autogenerated by 
> utils/update_test_checks.py
> +; RUN: opt -newgvn -S %s | FileCheck %s
> +
> +; Test for PR33165.
> +
> +; TODO: Currently NewGVN miscompiles the function.
> +define i2 @f(i2, i1) {
> +; CHECK-LABEL: @f(
> +; CHECK-NEXT:    [[A:%.*]] = xor i2 [[TMP0:%.*]], -1
> +; CHECK-NEXT:    [[B:%.*]] = select i1 [[TMP1:%.*]], i2 [[A]], i2 undef
> +; CHECK-NEXT:    ret i2 [[B]]
> +;
> +  %a = xor i2 %0, -1
> +  %b = select i1 %1, i2 %a, i2 undef
> +  %c = and i2 %a, %b
> +  ret i2 %c
> +}
> 
> diff  --git a/llvm/test/Transforms/NewGVN/todo-pr35074-phi-of-ops.ll 
> b/llvm/test/Transforms/NewGVN/todo-pr35074-phi-of-ops.ll
> new file mode 100644
> index 0000000000000..e80292e94fd1c
> --- /dev/null
> +++ b/llvm/test/Transforms/NewGVN/todo-pr35074-phi-of-ops.ll
> @@ -0,0 +1,35 @@
> +; RUN: opt -newgvn -S %s | FileCheck %s
> +
> +XFAIL: *
> +
> +; TODO: Test case for PR35074. Crashes caused by phi-of-ops.
> +define void @crash1_pr35074(i32 %this, i1 %c) {
> +entry:
> +  br label %for.cond
> +
> +for.cond:                                         ; preds = %for.inc6, 
> %entry
> +  %y.0 = phi i32 [ 1, %entry ], [ %inc7, %for.inc6 ]
> +  br i1 %c, label %for.inc6, label %for.body.lr.ph
> +
> +for.body.lr.ph:                                   ; preds = %for.cond
> +  %sub = add nsw i32 %y.0, -1
> +  br label %for.body4
> +
> +for.body4:                                        ; preds = 
> %for.body.lr.ph
> +  %cmp = icmp ugt i32 %sub, %y.0
> +  br i1 %cmp, label %for.end, label %for.body4.1
> +
> +for.end:                                          ; preds = 
> %for.body4.1, %for.body4
> +  ret void
> +
> +for.inc6:                                         ; preds = %for.cond
> +  %inc7 = add nuw nsw i32 %y.0, 1
> +  br label %for.cond
> +
> +for.body4.1:                                      ; preds = %for.body4
> +  %inc.1 = add nuw nsw i32 %y.0, 1
> +  tail call void @_blah(i32 %inc.1)
> +  br label %for.end
> +}
> +
> +declare void @_blah(i32)
> 
> diff  --git a/llvm/test/Transforms/NewGVN/todo-pr36335-phi-undef.ll 
> b/llvm/test/Transforms/NewGVN/todo-pr36335-phi-undef.ll
> new file mode 100644
> index 0000000000000..6208f4eb19346
> --- /dev/null
> +++ b/llvm/test/Transforms/NewGVN/todo-pr36335-phi-undef.ll
> @@ -0,0 +1,32 @@
> +; NOTE: Assertions have been autogenerated by 
> utils/update_test_checks.py
> +; RUN: opt -newgvn -S %s | FileCheck %s
> +
> +; TODO: NewGVN currently miscomiles the function below. PR36335.
> +
> +declare void @foo(i32)
> +
> +define void @main(i1 %c1, i1 %c2, i32 %x) {
> +; CHECK-LABEL: @main(
> +; CHECK-NEXT:  entry:
> +; CHECK-NEXT:    br i1 [[C1:%.*]], label [[L:%.*]], label [[END:%.*]]
> +; CHECK:       L:
> +; CHECK-NEXT:    [[XOR:%.*]] = xor i32 [[X:%.*]], -1
> +; CHECK-NEXT:    call void @foo(i32 [[XOR]])
> +; CHECK-NEXT:    br label [[L]]
> +; CHECK:       end:
> +; CHECK-NEXT:    ret void
> +;
> +entry:
> +  br i1 %c1, label %L, label %end
> +
> +L:
> +  %d.1 = phi i8 [ undef, %entry ], [ -1, %L ]
> +  %conv = sext i8 %d.1 to i32
> +  %xor = xor i32 %x, %conv
> +  %neg = xor i32 %xor, -1
> +  call void @foo(i32 %neg)
> +  br label %L
> +
> +end:
> +  ret void
> +}
> 
> diff  --git 
> a/llvm/test/Transforms/NewGVN/todo-pr37121-seens-this-value-a-lot.ll 
> b/llvm/test/Transforms/NewGVN/todo-pr37121-seens-this-value-a-lot.ll
> new file mode 100644
> index 0000000000000..b4961fa32ef00
> --- /dev/null
> +++ b/llvm/test/Transforms/NewGVN/todo-pr37121-seens-this-value-a-lot.ll
> @@ -0,0 +1,25 @@
> +; RUN: opt -newgvn -S %s | FileCheck %s
> +
> +; XFAIL: *
> +
> +; TODO: Current NewGVN crashes on the function below. See PR37121.
> +
> +define hidden void @foo() {
> +top:
> +  %.promoted = load i8, i8* undef, align 8
> +  br label %if
> +
> +;; This is really a multi-valued phi, because the phi is defined by an 
> expression of the phi.
> +;; This means that we can't propagate the value over the backedge, 
> because we'll just cycle
> +;; through every value.
> +
> +if:                                               ; preds = %if, %top
> +  %0 = phi i8 [ %1, %if ], [ %.promoted, %top ]
> +  %1 = xor i8 %0, undef
> +  br i1 false, label %L50, label %if
> +
> +L50:                                              ; preds = %if
> +  %.lcssa = phi i8 [ %1, %if ]
> +  store i8 %.lcssa, i8* undef, align 8
> +  ret void
> +}
> 
> diff  --git a/llvm/test/Transforms/NewGVN/todo-pr42422-phi-of-ops.ll 
> b/llvm/test/Transforms/NewGVN/todo-pr42422-phi-of-ops.ll
> new file mode 100644
> index 0000000000000..6c4cf5f82314b
> --- /dev/null
> +++ b/llvm/test/Transforms/NewGVN/todo-pr42422-phi-of-ops.ll
> @@ -0,0 +1,84 @@
> +; RUN: opt -newgvn -S %s | FileChecks %s
> +
> +; XFAIL: *
> +
> +; TODO: Currently NewGVN crashes on the function below, see PR42422.
> +
> +define void @d() {
> +entry:
> +  br label %for.cond
> +
> +for.cond:                                         ; preds = 
> %cleanup20, %entry
> +  br label %for.cond1
> +
> +for.cond1:                                        ; preds = 
> %for.inc17, %for.cond
> +  %0 = phi i32 [ %inc18, %for.inc17 ], [ 0, %for.cond ]
> +  %cmp = icmp sle i32 %0, 1
> +  br i1 %cmp, label %for.body, label %for.end19
> +
> +for.body:                                         ; preds = %for.cond1
> +  br i1 undef, label %for.body3, label %for.body.for.cond4_crit_edge
> +
> +for.body.for.cond4_crit_edge:                     ; preds = %for.body
> +  br label %for.cond4
> +
> +for.body3:                                        ; preds = %for.body
> +  br label %cleanup14
> +
> +for.cond4:                                        ; preds = %cleanup, 
> %for.body.for.cond4_crit_edge
> +  br i1 undef, label %if.then, label %if.end
> +
> +if.then:                                          ; preds = %for.cond4
> +  br label %cleanup
> +
> +if.end:                                           ; preds = %for.cond4
> +  br label %for.cond6
> +
> +for.cond6:                                        ; preds = %for.inc, 
> %if.end
> +  %1 = phi i64 [ %inc, %for.inc ], [ 0, %if.end ]
> +  %cmp7 = icmp sle i64 %1, 1
> +  br i1 %cmp7, label %for.inc, label %for.end9
> +
> +for.inc:                                          ; preds = %for.cond6
> +  %inc = add nsw i64 %1, 1
> +  br label %for.cond6
> +
> +for.end9:                                         ; preds = %for.cond6
> +  br i1 true, label %if.then11, label %if.end12
> +
> +if.then11:                                        ; preds = %for.end9
> +  br label %cleanup
> +
> +if.end12:                                         ; preds = %for.end9
> +  br label %cleanup
> +
> +cleanup:                                          ; preds = %if.end12, 
> %if.then11, %if.then
> +  %cleanup.dest = phi i32 [ undef, %if.end12 ], [ 1, %if.then11 ], [ 
> 9, %if.then ]
> +  switch i32 %cleanup.dest, label %cleanup14 [
> +    i32 0, label %for.cond4
> +    i32 9, label %for.end13
> +  ]
> +
> +for.end13:                                        ; preds = %cleanup
> +  br label %cleanup14
> +
> +cleanup14:                                        ; preds = 
> %for.end13, %cleanup, %for.body3
> +  %cleanup.dest15 = phi i32 [ 0, %for.end13 ], [ %cleanup.dest, 
> %cleanup ], [ 1, %for.body3 ]
> +  %cond1 = icmp eq i32 %cleanup.dest15, 0
> +  br i1 %cond1, label %for.inc17, label %cleanup20
> +
> +for.inc17:                                        ; preds = %cleanup14
> +  %inc18 = add nsw i32 %0, 1
> +  br label %for.cond1
> +
> +for.end19:                                        ; preds = %for.cond1
> +  br label %cleanup20
> +
> +cleanup20:                                        ; preds = 
> %for.end19, %cleanup14
> +  %cleanup.dest21 = phi i32 [ %cleanup.dest15, %cleanup14 ], [ 0, 
> %for.end19 ]
> +  %cond = icmp eq i32 %cleanup.dest21, 0
> +  br i1 %cond, label %for.cond, label %cleanup23
> +
> +cleanup23:                                        ; preds = %cleanup20
> +  ret void
> +}
> 
> 
>         
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


More information about the llvm-commits mailing list