Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / 2010-09-30-CMOV-JumpTable-PHI.ll
1 ; RUN: llc -verify-machineinstrs -mcpu=i386 < %s
2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
3 target triple = "i386-pc-linux-gnu"
4
5 ; The bb.i basic block gets split while emitting the schedule because
6 ; -mcpu=i386 doesn't have CMOV.'
7 ;
8 ; That causes the PHI to be updated wrong because the jumptable data structure is remembering the original MBB.
9 ;
10 ; -cgp-critical-edge-splitting=0 prevents the edge to PHI from being split.
11
12 @.str146 = external constant [4 x i8], align 1
13 @.str706 = external constant [4 x i8], align 1
14 @.str1189 = external constant [5 x i8], align 1
15
16 declare i32 @memcmp(i8* nocapture, i8* nocapture, i32) nounwind readonly
17 declare i32 @strlen(i8* nocapture) nounwind readonly
18
19 define hidden zeroext i8 @f(i8* %this, i8* %Name.0, i32 %Name.1, i8* noalias %NameLoc, i8* %Operands) nounwind align 2 {
20 bb.i:
21   %0 = icmp eq i8 undef, 0
22   %iftmp.285.0 = select i1 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str1189, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str706, i32 0, i32 0)
23   %1 = call i32 @strlen(i8* %iftmp.285.0) nounwind readonly
24   switch i32 %Name.1, label %_ZNK4llvm12StringSwitchINS_9StringRefES1_E7DefaultERKS1_.exit [
25     i32 3, label %bb1.i
26     i32 4, label %bb1.i1237
27     i32 5, label %bb1.i1266
28     i32 6, label %bb1.i1275
29     i32 2, label %bb1.i1434
30     i32 8, label %bb1.i1523
31     i32 7, label %bb1.i1537
32   ]
33
34 bb1.i:                                            ; preds = %bb.i
35   unreachable
36
37 bb1.i1237:                                        ; preds = %bb.i
38   br i1 undef, label %bb.i1820, label %bb1.i1241
39
40 bb1.i1241:                                        ; preds = %bb1.i1237
41   unreachable
42
43 bb1.i1266:                                        ; preds = %bb.i
44   unreachable
45
46 bb1.i1275:                                        ; preds = %bb.i
47   unreachable
48
49 bb1.i1434:                                        ; preds = %bb.i
50   unreachable
51
52 bb1.i1523:                                        ; preds = %bb.i
53   unreachable
54
55 bb1.i1537:                                        ; preds = %bb.i
56   unreachable
57
58 bb.i1820:                                         ; preds = %bb1.i1237
59   br label %_ZNK4llvm12StringSwitchINS_9StringRefES1_E7DefaultERKS1_.exit
60
61 _ZNK4llvm12StringSwitchINS_9StringRefES1_E7DefaultERKS1_.exit: ; preds = %bb.i1820, %bb.i
62   %PatchedName.0.0 = phi i8* [ undef, %bb.i1820 ], [ %Name.0, %bb.i ]
63   br i1 undef, label %bb141, label %_ZNK4llvm9StringRef10startswithES0_.exit
64
65 _ZNK4llvm9StringRef10startswithES0_.exit:         ; preds = %_ZNK4llvm12StringSwitchINS_9StringRefES1_E7DefaultERKS1_.exit
66   %2 = call i32 @memcmp(i8* %PatchedName.0.0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str146, i32 0, i32 0), i32 3) nounwind readonly
67   unreachable
68
69 bb141:                                            ; preds = %_ZNK4llvm12StringSwitchINS_9StringRefES1_E7DefaultERKS1_.exit
70   unreachable
71 }