forked from OSchip/llvm-project
[CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI.
llvm-svn: 360328
This commit is contained in:
parent
a8f8d3b01e
commit
38ef296265
|
@ -5904,7 +5904,7 @@ static bool isFormingBranchFromSelectProfitable(const TargetTransformInfo *TTI,
|
||||||
static Value *getTrueOrFalseValue(
|
static Value *getTrueOrFalseValue(
|
||||||
SelectInst *SI, bool isTrue,
|
SelectInst *SI, bool isTrue,
|
||||||
const SmallPtrSet<const Instruction *, 2> &Selects) {
|
const SmallPtrSet<const Instruction *, 2> &Selects) {
|
||||||
Value *V;
|
Value *V = nullptr;
|
||||||
|
|
||||||
for (SelectInst *DefSI = SI; DefSI != nullptr && Selects.count(DefSI);
|
for (SelectInst *DefSI = SI; DefSI != nullptr && Selects.count(DefSI);
|
||||||
DefSI = dyn_cast<SelectInst>(V)) {
|
DefSI = dyn_cast<SelectInst>(V)) {
|
||||||
|
@ -5912,6 +5912,8 @@ static Value *getTrueOrFalseValue(
|
||||||
"The condition of DefSI does not match with SI");
|
"The condition of DefSI does not match with SI");
|
||||||
V = (isTrue ? DefSI->getTrueValue() : DefSI->getFalseValue());
|
V = (isTrue ? DefSI->getTrueValue() : DefSI->getFalseValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(V && "Failed to get select true/false value");
|
||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue