Skip to content

Commit

Permalink
[X86] Check if machine loop is passed while getting loop alignment (#…
Browse files Browse the repository at this point in the history
…77283)

After d6bb96e, calling
getPrefLoopAlignment without passing in a pointer to a MachineLoop
causes a segmentation fault. This conflicts with the API in
TargetLoweringBase where the default MachineLoop pointer passed is
nullptr. This patch fixes this by checking if the pointer points to
something before enabling the optional functionality.
  • Loading branch information
boomanaiden154 committed Jan 8, 2024
1 parent 0141010 commit 053aed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -57672,7 +57672,7 @@ X86TargetLowering::getStackProbeSize(const MachineFunction &MF) const {
}

Align X86TargetLowering::getPrefLoopAlignment(MachineLoop *ML) const {
if (ML->isInnermost() &&
if (ML && ML->isInnermost() &&
ExperimentalPrefInnermostLoopAlignment.getNumOccurrences())
return Align(1ULL << ExperimentalPrefInnermostLoopAlignment);
return TargetLowering::getPrefLoopAlignment();
Expand Down

0 comments on commit 053aed2

Please sign in to comment.