llvm.org GIT mirror llvm / 1857b51
Make sure the non-SSE lowering for fences correctly clobbers EFLAGS. PR11768. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148240 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 8 years ago
2 changed file(s) with 35 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
550550 // Memory barriers
551551
552552 // TODO: Get this to fold the constant into the instruction.
553 let isCodeGenOnly = 1 in
553 let isCodeGenOnly = 1, Defs = [EFLAGS] in
554554 def OR32mrLocked : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$zero),
555555 "lock\n\t"
556556 "or{l}\t{$zero, $dst|$dst, $zero}",
0 ; RUN: llc < %s -mtriple=i686-linux -mattr=-sse | FileCheck %s
1 ; PR11768
2
3 @ptr = external global i8*
4
5 define void @baz() nounwind ssp {
6 entry:
7 %0 = load i8** @ptr, align 4
8 %cmp = icmp eq i8* %0, null
9 fence seq_cst
10 br i1 %cmp, label %if.then, label %if.else
11
12 ; Make sure the fence comes before the comparison, since it
13 ; clobbers EFLAGS.
14
15 ; CHECK: lock
16 ; CHECK-NEXT: orl {{.*}}, (%esp)
17 ; CHECK-NEXT: cmpl $0
18
19 if.then: ; preds = %entry
20 tail call void bitcast (void (...)* @foo to void ()*)() nounwind
21 br label %if.end
22
23 if.else: ; preds = %entry
24 tail call void bitcast (void (...)* @bar to void ()*)() nounwind
25 br label %if.end
26
27 if.end: ; preds = %if.else, %if.then
28 ret void
29 }
30
31 declare void @foo(...)
32
33 declare void @bar(...)