<div dir="ltr">Looks like this change broke the build:<div><br></div><div><a href="http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3908/steps/ninja%20check%201/logs/stdio">http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3908/steps/ninja%20check%201/logs/stdio</a><br></div><div><br></div><div><div>******************** TEST 'LLVM :: Transforms/BranchFolding/single-block-funclets.ll' FAILED ********************</div><div>Script:</div><div>--</div><div>/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</div><div>--</div><div>Exit Code: 2</div><div><br></div><div>Command Output (stderr):</div><div>--</div><div>/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.</div><div>FileCheck error: '-' is empty.</div><div><br></div><div>--</div></div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 3, 2015 at 10:58 AM Andrew Kaylor via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: akaylor<br>
Date: Thu Dec  3 12:55:28 2015<br>
New Revision: 254629<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=254629&view=rev" rel="noreferrer" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=254629&view=rev</a><br>
Log:<br>
[WinEH] Avoid infinite loop in BranchFolding for multiple single block funclets<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D14996" rel="noreferrer" target="_blank" class="cremed">http://reviews.llvm.org/D14996</a><br>
<br>
<br>
Added:<br>
    llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/BranchFolding.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=254629&r1=254628&r2=254629&view=diff" rel="noreferrer" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=254629&r1=254628&r2=254629&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Thu Dec  3 12:55:28 2015<br>
@@ -1564,6 +1564,14 @@ ReoptimizeBlock:<br>
       // removed, move this block to the end of the function.<br>
       MachineBasicBlock *PrevTBB = nullptr, *PrevFBB = nullptr;<br>
       SmallVector<MachineOperand, 4> PrevCond;<br>
+      // We're looking for cases where PrevBB could possibly fall through to<br>
+      // FallThrough, but if FallThrough is an EH pad that wouldn't be useful<br>
+      // so here we skip over any EH pads so we might have a chance to find<br>
+      // a branch target from PrevBB.<br>
+      while (FallThrough != MF.end() && FallThrough->isEHPad())<br>
+        ++FallThrough;<br>
+      // Now check to see if the current block is sitting between PrevBB and<br>
+      // a block to which it could fall through.<br>
       if (FallThrough != MF.end() &&<br>
           !TII->AnalyzeBranch(PrevBB, PrevTBB, PrevFBB, PrevCond, true) &&<br>
           PrevBB.isSuccessor(&*FallThrough)) {<br>
<br>
Added: llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll?rev=254629&view=auto" rel="noreferrer" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll?rev=254629&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll (added)<br>
+++ llvm/trunk/test/Transforms/BranchFolding/single-block-funclets.ll Thu Dec  3 12:55:28 2015<br>
@@ -0,0 +1,110 @@<br>
+; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s<br>
+<br>
+declare i32 @__CxxFrameHandler3(...)<br>
+<br>
+declare void @throw()<br>
+declare i16 @f()<br>
+<br>
+define i16 @test1(i16 %a, i8* %b) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {<br>
+entry:<br>
+  %cmp = icmp eq i16 %a, 10<br>
+  br i1 %cmp, label %if.then, label %if.else<br>
+<br>
+if.then:<br>
+  %call1 = invoke i16 @f()<br>
+          to label %cleanup unwind label %catch.dispatch<br>
+<br>
+if.else:<br>
+  %call2 = invoke i16 @f()<br>
+          to label %cleanup unwind label %catch.dispatch<br>
+<br>
+catch.dispatch:<br>
+  catchpad [i8* null, i32 8, i8* null]<br>
+          to label %catch unwind label %catch.dispatch.2<br>
+<br>
+catch:<br>
+  invoke void @throw() noreturn<br>
+          to label %unreachable unwind label %catchendblock<br>
+<br>
+catch.dispatch.2:<br>
+  catchpad [i8* null, i32 64, i8* null]<br>
+          to label %catch.2 unwind label %catchendblock<br>
+<br>
+catch.2:<br>
+  store i8 1, i8* %b<br>
+  invoke void @throw() noreturn<br>
+          to label %unreachable unwind label %catchendblock<br>
+<br>
+catchendblock:<br>
+  catchendpad unwind to caller<br>
+<br>
+cleanup:<br>
+  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ]<br>
+  ret i16 %retval<br>
+<br>
+unreachable:<br>
+  unreachable<br>
+}<br>
+<br>
+; This test verifies the case where two funclet blocks meet the old criteria<br>
+; to be placed at the end.  The order of the blocks is not important for the<br>
+; purposes of this test.  The failure mode is an infinite loop during<br>
+; compilation.<br>
+;<br>
+; CHECK-LABEL: .def     test1;<br>
+<br>
+define i16 @test2(i16 %a, i8* %b) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {<br>
+entry:<br>
+  %cmp = icmp eq i16 %a, 10<br>
+  br i1 %cmp, label %if.then, label %if.else<br>
+<br>
+if.then:<br>
+  %call1 = invoke i16 @f()<br>
+          to label %cleanup unwind label %catch.dispatch<br>
+<br>
+if.else:<br>
+  %call2 = invoke i16 @f()<br>
+          to label %cleanup unwind label %catch.dispatch<br>
+<br>
+catch.dispatch:<br>
+  catchpad [i8* null, i32 8, i8* null]<br>
+          to label %catch unwind label %catch.dispatch.2<br>
+<br>
+catch:<br>
+  invoke void @throw() noreturn<br>
+          to label %unreachable unwind label %catchendblock<br>
+<br>
+catch.dispatch.2:<br>
+  %c2 = catchpad [i8* null, i32 32, i8* null]<br>
+          to label %catch.2 unwind label %catch.dispatch.3<br>
+<br>
+catch.2:<br>
+  store i8 1, i8* %b<br>
+  catchret %c2 to label %cleanup<br>
+<br>
+catch.dispatch.3:<br>
+  %c3 = catchpad [i8* null, i32 64, i8* null]<br>
+          to label %catch.3 unwind label %catchendblock<br>
+<br>
+catch.3:<br>
+  store i8 2, i8* %b<br>
+  catchret %c3 to label %cleanup<br>
+<br>
+catchendblock:<br>
+  catchendpad unwind to caller<br>
+<br>
+cleanup:<br>
+  %retval = phi i16 [ %call1, %if.then ], [ %call2, %if.else ], [ -1, %catch.2 ], [ -1, %catch.3 ]<br>
+  ret i16 %retval<br>
+<br>
+unreachable:<br>
+  unreachable<br>
+}<br>
+<br>
+; This test verifies the case where three funclet blocks all meet the old<br>
+; criteria to be placed at the end.  The order of the blocks is not important<br>
+; for the purposes of this test.  The failure mode is an infinite loop during<br>
+; compilation.<br>
+;<br>
+; CHECK-LABEL: .def     test2;<br>
+<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="cremed">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="cremed">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>