This is from a second batch of tests I added; I'm testing a fix now. Sorry for the fallout, I didn't check enough of the bots before crashing!<div><br></div><div>-Chandler<br><br><div class="gmail_quote">On Fri, Oct 21, 2011 at 8:56 AM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hey Chandler,<br>
<br>
I think this test needs a target triple, not just -march. It's failing on Darwin with:<br>
<br>
/Users/grosbaj/sources/llvm/test/CodeGen/X86/block-placement.ll:82:10: error: expected string not found in input<br>
; CHECK: .align 16,<br>
         ^<br>
<stdin>:90:2: note: scanning from here<br>
 xorl %eax, %eax<br>
 ^<br>
<stdin>:93:2: note: possible intended match here<br>
 .align 4, 0x90<br>
<span class="HOEnZb"><font color="#888888"><br>
-Jim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Oct 21, 2011, at 1:01 AM, Chandler Carruth wrote:<br>
<br>
> Author: chandlerc<br>
> Date: Fri Oct 21 03:01:56 2011<br>
> New Revision: 142644<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=142644&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=142644&view=rev</a><br>
> Log:<br>
> Add a very basic test for MachineBlockPlacement. This is essentially the<br>
> canonical example I used when developing it, and is one of the primary<br>
> motivating real-world use cases for __builtin_expect (when burried under<br>
> a macro).<br>
><br>
> I'm working on more test cases here, but I'm trying to make sure both<br>
> that the pass is doing the right thing with the test cases and that they<br>
> aren't too brittle to changes elsewhere in the code generation pipeline.<br>
><br>
> Feedback and/or suggestions on how to test this are very welcome.<br>
> Especially feedback on whether testing the block comments is a good<br>
> strategy; I couldn't find any good examples to steal from but all the<br>
> other ideas I had were a lot uglier or more fragile.<br>
><br>
> Added:<br>
>    llvm/trunk/test/CodeGen/X86/block-placement.ll<br>
><br>
> Added: llvm/trunk/test/CodeGen/X86/block-placement.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=142644&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=142644&view=auto</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/X86/block-placement.ll (added)<br>
> +++ llvm/trunk/test/CodeGen/X86/block-placement.ll Fri Oct 21 03:01:56 2011<br>
> @@ -0,0 +1,75 @@<br>
> +; RUN: llc -march=x86 -enable-block-placement < %s | FileCheck %s<br>
> +<br>
> +declare void @error(i32 %i, i32 %a, i32 %b)<br>
> +<br>
> +define i32 @test1(i32 %i, i32* %a, i32 %b) {<br>
> +; Test a chain of ifs, where the block guarded by the if is error handling code<br>
> +; that is not expected to run.<br>
> +; CHECK: test1:<br>
> +; CHECK: %entry<br>
> +; CHECK: %else1<br>
> +; CHECK: %else2<br>
> +; CHECK: %else3<br>
> +; CHECK: %else4<br>
> +; CHECK: %exit<br>
> +; CHECK: %then1<br>
> +; CHECK: %then2<br>
> +; CHECK: %then3<br>
> +; CHECK: %then4<br>
> +; CHECK: %then5<br>
> +<br>
> +entry:<br>
> +  %gep1 = getelementptr i32* %a, i32 1<br>
> +  %val1 = load i32* %gep1<br>
> +  %cond1 = icmp ugt i32 %val1, 1<br>
> +  br i1 %cond1, label %then1, label %else1, !prof !0<br>
> +<br>
> +then1:<br>
> +  call void @error(i32 %i, i32 1, i32 %b)<br>
> +  br label %else1<br>
> +<br>
> +else1:<br>
> +  %gep2 = getelementptr i32* %a, i32 2<br>
> +  %val2 = load i32* %gep2<br>
> +  %cond2 = icmp ugt i32 %val2, 2<br>
> +  br i1 %cond2, label %then2, label %else2, !prof !0<br>
> +<br>
> +then2:<br>
> +  call void @error(i32 %i, i32 1, i32 %b)<br>
> +  br label %else2<br>
> +<br>
> +else2:<br>
> +  %gep3 = getelementptr i32* %a, i32 3<br>
> +  %val3 = load i32* %gep3<br>
> +  %cond3 = icmp ugt i32 %val3, 3<br>
> +  br i1 %cond3, label %then3, label %else3, !prof !0<br>
> +<br>
> +then3:<br>
> +  call void @error(i32 %i, i32 1, i32 %b)<br>
> +  br label %else3<br>
> +<br>
> +else3:<br>
> +  %gep4 = getelementptr i32* %a, i32 4<br>
> +  %val4 = load i32* %gep4<br>
> +  %cond4 = icmp ugt i32 %val4, 4<br>
> +  br i1 %cond4, label %then4, label %else4, !prof !0<br>
> +<br>
> +then4:<br>
> +  call void @error(i32 %i, i32 1, i32 %b)<br>
> +  br label %else4<br>
> +<br>
> +else4:<br>
> +  %gep5 = getelementptr i32* %a, i32 3<br>
> +  %val5 = load i32* %gep5<br>
> +  %cond5 = icmp ugt i32 %val5, 3<br>
> +  br i1 %cond5, label %then5, label %exit, !prof !0<br>
> +<br>
> +then5:<br>
> +  call void @error(i32 %i, i32 1, i32 %b)<br>
> +  br label %exit<br>
> +<br>
> +exit:<br>
> +  ret i32 %b<br>
> +}<br>
> +<br>
> +!0 = metadata !{metadata !"branch_weights", i32 4, i32 64}<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>