Skip to content

Commit 659c676

Browse files
DaMatrixdianqk
andcommitted
Update llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Co-authored-by: DianQK <[email protected]>
1 parent f9d54a5 commit 659c676

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6531,17 +6531,8 @@ SwitchLookupTable::SwitchLookupTable(
65316531
uint64_t Idx = (CaseVal->getValue() - Offset->getValue()).getLimitedValue();
65326532
TableContents[Idx] = CaseRes;
65336533

6534-
if (SingleValue && CaseRes != SingleValue) {
6535-
if (isa<PoisonValue>(SingleValue)) {
6536-
// All of the switch cases until now have returned poison.
6537-
// If this case returns a non-poison value, ignore the previous
6538-
// poisons and use this case's result as the single constant
6539-
// value.
6540-
if (!isa<PoisonValue>(CaseRes))
6541-
SingleValue = CaseRes;
6542-
} else if (!isa<PoisonValue>(CaseRes))
6543-
SingleValue = nullptr;
6544-
}
6534+
if (SingleValue && !isa<PoisonValue>(CaseRes) && CaseRes != SingleValue)
6535+
SingleValue = isa<PoisonValue>(SingleValue) ? CaseRes : nullptr;
65456536
}
65466537

65476538
// Fill in any holes in the table with the default result.

0 commit comments

Comments
 (0)