[all-commits] [llvm/llvm-project] 842dc3: Guard against dereferencing a nullptr

Akshay Khadse via All-commits all-commits at lists.llvm.org
Fri Apr 14 20:31:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 842dc35fc93203751047490f2989360b15ea67d1
      https://github.com/llvm/llvm-project/commit/842dc35fc93203751047490f2989360b15ea67d1
  Author: Akshay Khadse <akshayskhadse at gmail.com>
  Date:   2023-04-15 (Sat, 15 Apr 2023)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIFrameLowering.cpp

  Log Message:
  -----------
  Guard against dereferencing a nullptr

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`

Reviewed By: skan, arsenm

Differential Revision: https://reviews.llvm.org/D146791




More information about the All-commits mailing list