[llvm] Add non-null check before accessing pointer (PR #83459)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 23:21:18 PST 2024
================
@@ -1054,7 +1054,7 @@ void SIFoldOperands::foldOperand(
// Don't fold if OpToFold doesn't hold an aligned register.
const TargetRegisterClass *RC =
TRI->getRegClassForReg(*MRI, OpToFold.getReg());
- if (TRI->hasVectorRegisters(RC) && OpToFold.getSubReg()) {
+ if (RC && TRI->hasVectorRegisters(RC) && OpToFold.getSubReg()) {
----------------
arsenm wrote:
There's no context that can reach here where this can fail
https://github.com/llvm/llvm-project/pull/83459
More information about the llvm-commits
mailing list