[llvm] [TableGen] Improve handling for dag op names (PR #149248)

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 22:04:49 PDT 2025


================
@@ -1310,7 +1319,7 @@ const Init *BinOpInit::Fold(const Record *CurRec) const {
       SmallVector<std::pair<const Init *, const StringInit *>, 8> Args;
       llvm::append_range(Args, LHSs->getArgAndNames());
       llvm::append_range(Args, RHSs->getArgAndNames());
-      return DagInit::get(Op, Args);
+      return DagInit::get(Op, LHSs->getName(), Args);
----------------
nemanjai wrote:

I am certainly not opposed to doing so. I didn't do it initially in order to ensure consistency of behaviour (i.e. always using the name of the LHS regardless of whether it exists). However, perhaps I should favour the LHS name if set and use the RHS name if the LHS name isn't.
I should also perhaps add a note about that behaviour in the documentation. Please let me know what you think.

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


More information about the llvm-commits mailing list