This is an archive of the discontinued LLVM Phabricator instance.

Guard against dereferencing a nullptr
ClosedPublic

Authored by akshaykhadse on Mar 24 2023, 1:42 AM.

Details

Summary

In lib/CodeGen/PrologEpilogInserter.cpp file, RS is assigned via RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : nullptr;. This means that RS can be nullptr. While executing the TFI->processFunctionBeforeFrameFinalized(MF, RS);, the RS can be dereferenced in the call RS->enterBasicBlock(MBB); in file lib/Target/AMDGPU/SIFrameLowering.cpp

Diff Detail

Event Timeline

akshaykhadse created this revision.Mar 24 2023, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2023, 1:42 AM
akshaykhadse requested review of this revision.Mar 24 2023, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2023, 1:42 AM
akshaykhadse edited the summary of this revision. (Show Details)Mar 24 2023, 1:52 AM
akshaykhadse added a reviewer: craig.topper.
arsenm accepted this revision.Apr 14 2023, 4:56 AM
This revision is now accepted and ready to land.Apr 14 2023, 4:56 AM
skan accepted this revision.Apr 14 2023, 5:00 AM
skan added inline comments.
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
1353

Error message?

@akshaykhadse, do you want me to help to land the patch?

@akshaykhadse, do you want me to help to land the patch?

Yes. That would be great!

This revision was automatically updated to reflect the committed changes.