[clang] [llvm] [Clang] Add `__builtin_stack_address` (PR #148281)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 08:57:53 PDT 2025


================
@@ -3680,6 +3681,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     Results.push_back(Tmp1);
     break;
   }
+  case ISD::STACKADDRESS:
   case ISD::STACKSAVE:
     // Expand to CopyFromReg if the target set
     // StackPointerRegisterToSaveRestore.
----------------
moorabbit wrote:

You're right, silently emitting an `UNDEF` node for `ISD::STACKADDRESS` and `ISD::STACKSAVE` sounds like a bad idea.

> For STACKADDRESS that should probably result in a legalization error.

Is it possible to report a legalization error without crashing LLVM?

Should we simply issue a diagnostic for both `ISD::STACKADDRESS` and `ISD:::STACKSAVE` in this case instead of silently emitting an UNDEF node?

Thx.


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


More information about the llvm-commits mailing list