LegacyDivergenceAnalysis: fix uninitialized value

Change-Id: I014502e431a68f7beddf169f6a3d19dac5dd2c26
llvm-svn: 348051
This commit is contained in:
Nicolai Haehnle 2018-11-30 23:07:49 +00:00
parent a7b00058e0
commit 413f8691ab
1 changed files with 3 additions and 1 deletions

View File

@ -356,7 +356,7 @@ void LegacyDivergenceAnalysis::print(raw_ostream &OS, const Module *) const {
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_ostream &OS, const Module *) const {
} else if (gpuDA) {
F = &gpuDA->getFunction();
}
if (!F)
return;
// Dumps all divergent values in F, arguments and then instructions.
for (auto &Arg : F->args()) {