Skip to content

Commit

Permalink
[Attributor] Don't crash if getAnalysisResultForFunction() returns nu…
Browse files Browse the repository at this point in the history
…ll LoopInfo

I have no idea what's going on here. This code was moved
around/introduced in change cb26b01 and starts crashing with a NULL
dereference once I apply https://reviews.llvm.org/D123090. I assume that
I've unwittingly taught the attributor enough that it's able to do more
clever things than in the past, and it's able to trip on this case. I
make no claims about the correctness of this patch, but it passes tests
and seems to fix all the crashes I've been seeing.

Differential Revision: https://reviews.llvm.org/D129589
  • Loading branch information
durin42 committed Jul 12, 2022
1 parent 5edfc0b commit 9029bda
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Expand Up @@ -6402,6 +6402,8 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
MayContainIrreducibleControl = mayContainIrreducibleControl(*F, LI);
if (MayContainIrreducibleControl.value())
return true;
if (!LI)
return true;
return LI->getLoopFor(&BB) != nullptr;
};

Expand Down

0 comments on commit 9029bda

Please sign in to comment.