Skip to content

Commit 053aed2

Browse files
[X86] Check if machine loop is passed while getting loop alignment (#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.
1 parent 0141010 commit 053aed2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57672,7 +57672,7 @@ X86TargetLowering::getStackProbeSize(const MachineFunction &MF) const {
5767257672
}
5767357673

5767457674
Align X86TargetLowering::getPrefLoopAlignment(MachineLoop *ML) const {
57675-
if (ML->isInnermost() &&
57675+
if (ML && ML->isInnermost() &&
5767657676
ExperimentalPrefInnermostLoopAlignment.getNumOccurrences())
5767757677
return Align(1ULL << ExperimentalPrefInnermostLoopAlignment);
5767857678
return TargetLowering::getPrefLoopAlignment();

0 commit comments

Comments
 (0)