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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 00:47:49 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.
----------------
nikic wrote:

I'm a bit concerned about the getUNDEF code path if getStackPointerRegisterToSaveRestore doesn't return anything. For STACKADDRESS that should probably result in a legalization error. (I guess it's okay for stacksave + stackrestore because in that case stackrestore also ignores the value.)

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


More information about the llvm-commits mailing list