aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2025-05-01 08:58:59 +0100
committerGitHub <noreply@github.com>2025-05-01 08:58:59 +0100
commit9b1051281e439fcf6f6ccf03766c5bcf04ceec4b (patch)
tree74c55449fa1e31cbfb31d8d276b0d63ddcfdd056 /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
parent0d3d2f639c42b22fc1b9453c7b834dbb0f16c0dc (diff)
downloadllvm-9b1051281e439fcf6f6ccf03766c5bcf04ceec4b.zip
llvm-9b1051281e439fcf6f6ccf03766c5bcf04ceec4b.tar.gz
llvm-9b1051281e439fcf6f6ccf03766c5bcf04ceec4b.tar.bz2
[DAG] Use SDValue for PatFrag checks (#137519)
If the SDNode is used it can pick up the wrong results number, for example looking at the known bits of the first result where it should be looking at the second. The SDValue is already present as the SelectCodeCommon checks move from parent to child, pass the SDValue through to CheckNodePredicate as Op so that it can use it if necessary. SDNode *N is still generated, keeping most PatFrags the same. Fixes #137274
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
-rw-r--r--llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 20b313d..febcb1f 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -1375,11 +1375,11 @@ std::string TreePredicateFn::getCodeToRunOnSDNode() const {
std::string Result = (" " + getImmType() + " Imm = ").str();
if (immCodeUsesAPFloat())
- Result += "cast<ConstantFPSDNode>(Node)->getValueAPF();\n";
+ Result += "cast<ConstantFPSDNode>(Op.getNode())->getValueAPF();\n";
else if (immCodeUsesAPInt())
- Result += "Node->getAsAPIntVal();\n";
+ Result += "Op->getAsAPIntVal();\n";
else
- Result += "cast<ConstantSDNode>(Node)->getSExtValue();\n";
+ Result += "cast<ConstantSDNode>(Op.getNode())->getSExtValue();\n";
return Result + ImmCode;
}
@@ -1410,9 +1410,9 @@ std::string TreePredicateFn::getCodeToRunOnSDNode() const {
std::string Result;
if (ClassName == "SDNode")
- Result = " SDNode *N = Node;\n";
+ Result = " SDNode *N = Op.getNode();\n";
else
- Result = " auto *N = cast<" + ClassName.str() + ">(Node);\n";
+ Result = " auto *N = cast<" + ClassName.str() + ">(Op.getNode());\n";
return (Twine(Result) + " (void)N;\n" + getPredCode()).str();
}