[llvm] r360328 - [CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 03:51:26 PDT 2019
Author: rksimon
Date: Thu May 9 03:51:26 2019
New Revision: 360328
URL: http://llvm.org/viewvc/llvm-project?rev=360328&view=rev
Log:
[CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI.
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=360328&r1=360327&r2=360328&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Thu May 9 03:51:26 2019
@@ -5904,7 +5904,7 @@ static bool isFormingBranchFromSelectPro
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;
}
More information about the llvm-commits
mailing list