Skip to content

Commit 85ff6d6

Browse files
committed
[TableGen] Fix a potential crash when operand doesn't appear in the instruction pattern
We have a check of whether an operand is in the instruction pattern, and emit an error if it is not, but we simply continue execution, including directly dereferencing a point-like object `InVal`, which will be just created when accessing the map. It contains a `nullptr` so dereferencing it causes crash. This is a very trivial fix.
1 parent c91a0a2 commit 85ff6d6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3872,6 +3872,7 @@ void CodeGenDAGPatterns::parseInstructionPattern(CodeGenInstruction &CGI,
38723872
}
38733873
I.error("Operand $" + OpName +
38743874
" does not appear in the instruction pattern");
3875+
continue;
38753876
}
38763877
TreePatternNodePtr InVal = InstInputs[OpName];
38773878
InstInputs.erase(OpName); // It occurred, remove from map.

0 commit comments

Comments
 (0)