Skip to content

Commit fb8e0ec

Browse files
committed
[PredicateInfo] Let phi use associate multi-LN_Last-defs
1 parent f2b6b23 commit fb8e0ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/lib/Transforms/Utils/PredicateInfo.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,14 @@ bool PredicateInfoBuilder::stackIsInScope(const ValueDFSStack &Stack,
261261
// the stack when we hit the end of the phi uses for a given def.
262262
const ValueDFS &Top = *Stack.back().V;
263263
if (Top.LocalNum == LN_Last && Top.PInfo) {
264-
if (!VDUse.U)
265-
return false;
264+
if (!VDUse.U) {
265+
assert(VDUse.PInfo && "A non-use VDUse should have a predicate info");
266+
// We should reserve adjacent LN_Last defs for the same phi use.
267+
return VDUse.LocalNum == LN_Last &&
268+
// If the two phi defs have the same edge, they must be designated
269+
// for the same succ BB.
270+
getBlockEdge(Top.PInfo) == getBlockEdge(VDUse.PInfo);
271+
}
266272
auto *PHI = dyn_cast<PHINode>(VDUse.U->getUser());
267273
if (!PHI)
268274
return false;

0 commit comments

Comments
 (0)