[llvm] Add non-null check before accessing pointer (PR #83459)
Martin Wehking via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 08:10:39 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()) {
----------------
MartinWehking wrote:
Hi Matt, yes an assert should also silence the issue:[1af318e](https://github.com/llvm/llvm-project/pull/83459/commits/1af318e8bacc13a5118303f6f444a8983e0ce9f0)
https://github.com/llvm/llvm-project/pull/83459
More information about the llvm-commits
mailing list