From c350a3e6fc25c6efba526d027e2ae5e31c7c44fb Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 9 May 2019 10:51:26 +0000 Subject: [PATCH] [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 --- lib/CodeGen/CodeGenPrepare.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.50.1