[clang] [llvm] [SystemZ] Global Stackprotector and associated location section (PR #169317)

Dominik Steenken via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 2 07:14:51 PST 2026


================
@@ -8891,6 +8964,43 @@ SDValue SystemZTargetLowering::combineBR_CCMASK(SDNode *N,
                        DAG.getTargetConstant(CCValidVal, SDLoc(N), MVT::i32),
                        DAG.getTargetConstant(CCMaskVal, SDLoc(N), MVT::i32),
                        N->getOperand(3), CCReg);
+
+  SDLoc DL(N);
+
+  // Combine BR_CCMASK (ICMP (Load FI, Load StackGuard)) into BRC
+  // (COMPARE_STACK_GUARD)
+  int FI = 0;
+  SDValue InChain, OutChain, StackGuardLoad;
+  if (isStackGuardCheck(N, FI, InChain, OutChain, StackGuardLoad, DCI)) {
----------------
dominik-steenken wrote:

I have now added a new `SystemZISD` opcode. That is returned by `getCmp` in the appropriate circumstance, and turned into a DAG node in `emitCmp`. This avoids the DAG Combine. The DAG machine opcode (now called `COMPARE_SG_DAG`) is now selected for this node in DAGToDAG Isel, and from there, the custom insertion works as before.

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


More information about the cfe-commits mailing list