From: Simon Pilgrim Date: Thu, 9 May 2019 10:51:26 +0000 (+0000) Subject: [CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c350a3e6fc25c6efba526d027e2ae5e31c7c44fb;p=llvm [CodeGenPrepare] Ensure we get a non-null result from getTrueOrFalseValue. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360328 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index fad3d4a596e..76f82c27847 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -5904,7 +5904,7 @@ static bool isFormingBranchFromSelectProfitable(const TargetTransformInfo *TTI, static Value *getTrueOrFalseValue( SelectInst *SI, bool isTrue, const SmallPtrSet &Selects) { - Value *V; + Value *V = nullptr; for (SelectInst *DefSI = SI; DefSI != nullptr && Selects.count(DefSI); DefSI = dyn_cast(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; }