[llvm] r254629 - [WinEH] Avoid infinite loop in BranchFolding for multiple single block funclets

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 11:59:41 PST 2015


Looks like this change broke the build:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3908/steps/ninja%20check%201/logs/stdio

******************** TEST 'LLVM ::
Transforms/BranchFolding/single-block-funclets.ll' FAILED
********************
Script:
--
/home/renato.golin/buildslave/clang-cmake-aarch64-42vma/stage1/./bin/llc
-mtriple=x86_64-pc-windows-msvc <
/home/renato.golin/buildslave/clang-cmake-aarch64-42vma/llvm/test/Transforms/BranchFolding/single-block-funclets.ll
|
/home/renato.golin/buildslave/clang-cmake-aarch64-42vma/stage1/./bin/FileCheck
/home/renato.golin/buildslave/clang-cmake-aarch64-42vma/llvm/test/Transforms/BranchFolding/single-block-funclets.ll
--
Exit Code: 2

Command Output (stderr):
--
/home/renato.golin/buildslave/clang-cmake-aarch64-42vma/stage1/./bin/llc: :
error: unable to get target for 'x86_64-pc-windows-msvc', see --version and
--triple.
FileCheck error: '-' is empty.

--


On Thu, Dec 3, 2015 at 10:58 AM Andrew Kaylor via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: akaylor
> Date: Thu Dec  3 12:55:28 2015
> New Revision: 254629
>
> URL: http://llvm.org/viewvc/llvm-project?rev=254629&view=rev
> Log:
> [WinEH] Avoid infinite loop in BranchFolding for multiple single block
> funclets
>
> Differential Revision: http://reviews.llvm.org/D14996
>
>
> Added:
>     llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll
> Modified:
>     llvm/trunk/lib/CodeGen/BranchFolding.cpp
>
> Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=254629&r1=254628&r2=254629&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
> +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Thu Dec  3 12:55:28 2015
> @@ -1564,6 +1564,14 @@ ReoptimizeBlock:
>        // removed, move this block to the end of the function.
>        MachineBasicBlock *PrevTBB = nullptr, *PrevFBB = nullptr;
>        SmallVector<MachineOperand, 4> PrevCond;
> +      // We're looking for cases where PrevBB could possibly fall through
> to
> +      // FallThrough, but if FallThrough is an EH pad that wouldn't be
> useful
> +      // so here we skip over any EH pads so we might have a chance to
> find
> +      // a branch target from PrevBB.
> +      while (FallThrough != MF.end() && FallThrough->isEHPad())
> +        ++FallThrough;
> +      // Now check to see if the current block is sitting between PrevBB
> and
> +      // a block to which it could fall through.
>        if (FallThrough != MF.end() &&
>            !TII->AnalyzeBranch(PrevBB, PrevTBB, PrevFBB, PrevCond, true) &&
>            PrevBB.isSuccessor(&*FallThrough)) {
>
> Added: llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll?rev=254629&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll
> (added)
> +++ llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll Thu
> Dec  3 12:55:28 2015
> @@ -0,0 +1,110 @@
> +; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
> +
> +declare i32 @__CxxFrameHandler3(...)
> +
> +declare void @throw()
> +declare i16 @f()
> +
> +define i16 @test1(i16 %a, i8* %b) personality i8* bitcast (i32 (...)*
> @__CxxFrameHandler3 to i8*) {
> +entry:
> +  %cmp = icmp eq i16 %a, 10
> +  br i1 %cmp, label %if.then, label %if.else
> +
> +if.then:
> +  %call1 = invoke i16 @f()
> +          to label %cleanup unwind label %catch.dispatch
> +
> +if.else:
> +  %call2 = invoke i16 @f()
> +          to label %cleanup unwind label %catch.dispatch
> +
> +catch.dispatch:
> +  catchpad [i8* null, i32 8, i8* null]
> +          to label %catch unwind label %catch.dispatch.2
> +
> +catch:
> +  invoke void @throw() noreturn
> +          to label %unreachable unwind label %catchendblock
> +
> +catch.dispatch.2:
> +  catchpad [i8* null, i32 64, i8* null]
> +          to label %catch.2 unwind label %catchendblock
> +
> +catch.2:
> +  store i8 1, i8* %b
> +  invoke void @throw() noreturn
> +          to label %unreachable unwind label %catchendblock
> +
> +catchendblock:
> +  catchendpad unwind to caller
> +
> +cleanup:
> +  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ]
> +  ret i16 %retval
> +
> +unreachable:
> +  unreachable
> +}
> +
> +; This test verifies the case where two funclet blocks meet the old
> criteria
> +; to be placed at the end.  The order of the blocks is not important for
> the
> +; purposes of this test.  The failure mode is an infinite loop during
> +; compilation.
> +;
> +; CHECK-LABEL: .def     test1;
> +
> +define i16 @test2(i16 %a, i8* %b) personality i8* bitcast (i32 (...)*
> @__CxxFrameHandler3 to i8*) {
> +entry:
> +  %cmp = icmp eq i16 %a, 10
> +  br i1 %cmp, label %if.then, label %if.else
> +
> +if.then:
> +  %call1 = invoke i16 @f()
> +          to label %cleanup unwind label %catch.dispatch
> +
> +if.else:
> +  %call2 = invoke i16 @f()
> +          to label %cleanup unwind label %catch.dispatch
> +
> +catch.dispatch:
> +  catchpad [i8* null, i32 8, i8* null]
> +          to label %catch unwind label %catch.dispatch.2
> +
> +catch:
> +  invoke void @throw() noreturn
> +          to label %unreachable unwind label %catchendblock
> +
> +catch.dispatch.2:
> +  %c2 = catchpad [i8* null, i32 32, i8* null]
> +          to label %catch.2 unwind label %catch.dispatch.3
> +
> +catch.2:
> +  store i8 1, i8* %b
> +  catchret %c2 to label %cleanup
> +
> +catch.dispatch.3:
> +  %c3 = catchpad [i8* null, i32 64, i8* null]
> +          to label %catch.3 unwind label %catchendblock
> +
> +catch.3:
> +  store i8 2, i8* %b
> +  catchret %c3 to label %cleanup
> +
> +catchendblock:
> +  catchendpad unwind to caller
> +
> +cleanup:
> +  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ], [ -1,
> %catch.2 ], [ -1, %catch.3 ]
> +  ret i16 %retval
> +
> +unreachable:
> +  unreachable
> +}
> +
> +; This test verifies the case where three funclet blocks all meet the old
> +; criteria to be placed at the end.  The order of the blocks is not
> important
> +; for the purposes of this test.  The failure mode is an infinite loop
> during
> +; compilation.
> +;
> +; CHECK-LABEL: .def     test2;
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151203/d48d41a9/attachment.html>


More information about the llvm-commits mailing list