[llvm] [AMDGPU] Expand constant named barrier matching in SDag (PR #191506)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 02:47:59 PDT 2026


================
@@ -12066,19 +12084,10 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
     if (CntC && CntC->isZero()) {
       SDValue Chain = Op->getOperand(0);
       SDValue BarOp = Op->getOperand(2);
-      SmallVector<SDValue, 2> Ops;
-
-      std::optional<uint64_t> BarVal;
-      if (auto *C = dyn_cast<ConstantSDNode>(BarOp))
-        BarVal = C->getZExtValue();
-      else if (auto *GA = dyn_cast<GlobalAddressSDNode>(BarOp))
-        if (auto Addr = AMDGPUMachineFunctionInfo::getLDSAbsoluteAddress(
-                *GA->getGlobal()))
-          BarVal = *Addr + GA->getOffset();
-
-      if (BarVal) {
-        unsigned BarID = (*BarVal >> 4) & 0x3F;
-        Ops.push_back(DAG.getTargetConstant(BarID, DL, MVT::i32));
+
+      if (auto BarID = getConstantNamedBarrierNumber(BarOp)) {
+        SmallVector<SDValue, 2> Ops;
----------------
arsenm wrote:

This can be a regular array with initializer list 

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


More information about the llvm-commits mailing list