[llvm] [TableGen] Fix potential null pointer dereference in parseInstruction (PR #180767)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 08:16:37 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: None (JaydeepChauhan14)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/180767.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp (+2) 


``````````diff
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 5827497488943..6874f45fbf78b 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -4014,6 +4014,8 @@ void CodeGenDAGPatterns::parseInstructionPattern(const CodeGenInstruction &CGI,
               " should be a set destination: all "
               "outputs must occur before inputs in operand list!");
 
+    assert(R && "Record should not be null");
+
     if (!checkOperandClass(CGI.Operands[i], R))
       I.error("Operand $" + OpName + " class mismatch!");
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/180767


More information about the llvm-commits mailing list