llvm.org GIT mirror llvm / c76d121
be layout aware, to produce: testb $1, %al je LBB0_2 ## BB#1: ## %if.then movb $0, %al instead of: testb $1, %al jne LBB0_1 jmp LBB0_2 LBB0_1: ## %if.then movb $0, %al how 'bout that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129749 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 10 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
10831083 if (OpReg == 0) return false;
10841084 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(TestOpc))
10851085 .addReg(OpReg).addImm(1);
1086 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(X86::JNE_4))
1086
1087 unsigned JmpOpc = X86::JNE_4;
1088 if (FuncInfo.MBB->isLayoutSuccessor(TrueMBB)) {
1089 std::swap(TrueMBB, FalseMBB);
1090 JmpOpc = X86::JE_4;
1091 }
1092
1093 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(JmpOpc))
10871094 .addMBB(TrueMBB);
10881095 FastEmitBranch(FalseMBB, DL);
10891096 FuncInfo.MBB->addSuccessor(TrueMBB);
141141 ret void
142142 ; CHECK: test12:
143143 ; CHECK: testb $1,
144 ; CHECK-NEXT: je L
145 ; CHECK-NEXT: movb $0, %al
144146 }
145147