Skip to content

[TableGen] !subst on a dag should retain name of operator #141195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/TableGen/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ static const Init *ForeachDagApply(const Init *LHS, const DagInit *MHSd,
}

if (Change)
return DagInit::get(Val, NewArgs);
return DagInit::get(Val, MHSd->getName(), NewArgs);
return MHSd;
}

Expand Down
18 changes: 18 additions & 0 deletions llvm/test/TableGen/dag-subst.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: llvm-tblgen %s | FileCheck %s

// Operator name "frg" in one_frag:$frg was not retained during !subst.

def one_frag;
def FPR32;
def ops;
def node;
def GPR;
def cond;
def set;
def FPR32_NEW;
def a {
dag d = (set FPR32:$dst, (one_frag:$frg FPR32:$a, FPR32:$b));
dag n = !foreach(i, d, !subst(FPR32, FPR32_NEW, i));
}

// CHECK: dag n = (set FPR32_NEW:$dst, (one_frag:$frg FPR32_NEW:$a, FPR32_NEW:$b));
Loading