# Changeset View

Changeset View

# Standalone View

Standalone View

# llvm/lib/CodeGen/CodeGenPrepare.cpp

- This file is larger than 256 KB, so syntax highlighting is disabled by default.

Show First 20 Lines • Show All 1175 Lines • ▼ Show 20 Line(s) | 1172 | if (BO->hasOneUse() && BO->user_back() == Cmp) { | |||
---|---|---|---|---|---|

1176 | InsertPt = Cmp; | 1176 | InsertPt = Cmp; | ||

1177 | } else { | 1177 | } else { | ||

1178 | // The math and compare may be independent instructions. Check dominance to | 1178 | // The math and compare may be independent instructions. Check dominance to | ||

1179 | // determine the insertion point for the intrinsic. | 1179 | // determine the insertion point for the intrinsic. | ||

1180 | bool MathDominates = DT.dominates(BO, Cmp); | 1180 | bool MathDominates = DT.dominates(BO, Cmp); | ||

1181 | if (!MathDominates && !DT.dominates(Cmp, BO)) | 1181 | if (!MathDominates && !DT.dominates(Cmp, BO)) | ||

1182 | return false; | 1182 | return false; | ||

1183 | 1183 | | |||

1184 | // Check that the insertion doesn't create a value that is live across more | | |||

1185 | // than two blocks, so to minimise the increase in register pressure. | | |||

1186 | BasicBlock *MathBB = BO->getParent(), *CmpBB = Cmp->getParent(); | 1184 | BasicBlock *MathBB = BO->getParent(), *CmpBB = Cmp->getParent(); | ||

1187 | if (MathBB != CmpBB) { | 1185 | if (MathBB != CmpBB) { | ||

1186 | // Avoid hoisting an extra op into a dominating block and creating a | ||||

1187 | // potentially longer critical path. | ||||

1188 | if (!MathDominates) | ||||

1189 | return false; | ||||

1190 | // Check that the insertion doesn't create a value that is live across | ||||

1191 | // more than two blocks, so to minimise the increase in register pressure. | ||||

1188 | BasicBlock *Dominator = MathDominates ? MathBB : CmpBB; | 1192 | BasicBlock *Dominator = MathDominates ? MathBB : CmpBB; | ||

1189 | BasicBlock *Dominated = MathDominates ? CmpBB : MathBB; | 1193 | BasicBlock *Dominated = MathDominates ? CmpBB : MathBB; | ||

1190 | auto Successors = successors(Dominator); | 1194 | auto Successors = successors(Dominator); | ||

1191 | if (llvm::find(Successors, Dominated) == Successors.end()) | 1195 | if (llvm::find(Successors, Dominated) == Successors.end()) | ||

1192 | return false; | 1196 | return false; | ||

1193 | } | 1197 | } | ||

1194 | 1198 | | |||

1195 | InsertPt = MathDominates ? cast<Instruction>(BO) : cast<Instruction>(Cmp); | 1199 | InsertPt = MathDominates ? cast<Instruction>(BO) : cast<Instruction>(Cmp); | ||

▲ Show 20 Lines • Show All 6104 Lines • Show Last 20 Lines |