[llvm] r348051 - LegacyDivergenceAnalysis: fix uninitialized value
Nicolai Haehnle via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 30 15:07:49 PST 2018
Author: nha
Date: Fri Nov 30 15:07:49 2018
New Revision: 348051
URL: http://llvm.org/viewvc/llvm-project?rev=348051&view=rev
Log:
LegacyDivergenceAnalysis: fix uninitialized value
Change-Id: I014502e431a68f7beddf169f6a3d19dac5dd2c26
Modified:
llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp?rev=348051&r1=348050&r2=348051&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LegacyDivergenceAnalysis.cpp Fri Nov 30 15:07:49 2018
@@ -356,7 +356,7 @@ void LegacyDivergenceAnalysis::print(raw
if ((!gpuDA || !gpuDA->hasDivergence()) && DivergentValues.empty())
return;
- const Function *F;
+ const Function *F = nullptr;
if (!DivergentValues.empty()) {
const Value *FirstDivergentValue = *DivergentValues.begin();
if (const Argument *Arg = dyn_cast<Argument>(FirstDivergentValue)) {
@@ -370,6 +370,8 @@ void LegacyDivergenceAnalysis::print(raw
} else if (gpuDA) {
F = &gpuDA->getFunction();
}
+ if (!F)
+ return;
// Dumps all divergent values in F, arguments and then instructions.
for (auto &Arg : F->args()) {
More information about the llvm-commits
mailing list