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

Ulrich Weigand via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 07:29:37 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)) {
----------------
uweigand wrote:

I don't understand why this needs to be done in combineBR_CCMASK - and why the branch needs to be touched at all.   Shouldn't we simply be able to replace the ICMP with COMPARE_STACK_GUARD_DAG either in a (to be added) combineICMP routine, or even just emit it this way from the beginning in getCmp/emitCmp?

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


More information about the cfe-commits mailing list