[CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI.

llvm-svn: 360328
This commit is contained in:
Simon Pilgrim 2019-05-09 10:51:26 +00:00
parent a8f8d3b01e
commit 38ef296265
1 changed files with 3 additions and 1 deletions

View File

@ -5904,7 +5904,7 @@ static bool isFormingBranchFromSelectProfitable(const TargetTransformInfo *TTI,
static Value *getTrueOrFalseValue(
SelectInst *SI, bool isTrue,
const SmallPtrSet<const Instruction *, 2> &Selects) {
Value *V;
Value *V = nullptr;
for (SelectInst *DefSI = SI; DefSI != nullptr && Selects.count(DefSI);
DefSI = dyn_cast<SelectInst>(V)) {
@ -5912,6 +5912,8 @@ static Value *getTrueOrFalseValue(
"The condition of DefSI does not match with SI");
V = (isTrue ? DefSI->getTrueValue() : DefSI->getFalseValue());
}
assert(V && "Failed to get select true/false value");
return V;
}