================ @@ -537,59 +537,52 @@ void NVPTXAsmPrinter::emitKernelFunctionDirectives(const Function &F, raw_ostream &O) const { // If the NVVM IR has some of reqntid* specified, then output // the reqntid directive, and set the unspecified ones to 1. - // If none of reqntid* is specified, don't output reqntid directive. - unsigned reqntidx, reqntidy, reqntidz; - bool specified = false; - if (!getReqNTIDx(F, reqntidx)) - reqntidx = 1; - else - specified = true; - if (!getReqNTIDy(F, reqntidy)) - reqntidy = 1; - else - specified = true; - if (!getReqNTIDz(F, reqntidz)) - reqntidz = 1; - else - specified = true; - - if (specified) - O << ".reqntid " << reqntidx << ", " << reqntidy << ", " << reqntidz + // If none of Reqntid* is specified, don't output reqntid directive. + unsigned Reqntidx, Reqntidy, Reqntidz; + Reqntidx = Reqntidy = Reqntidz = 1; + bool ReqSpecified = false; + if (getReqNTIDx(F, Reqntidx)) + ReqSpecified |= true; + if (getReqNTIDy(F, Reqntidy)) + ReqSpecified |= true; + if (getReqNTIDz(F, Reqntidz)) + ReqSpecified |= true; + + if (ReqSpecified) + O << ".reqntid " << Reqntidx << ", " << Reqntidy << ", " << Reqntidz << "\n"; // If the NVVM IR has some of maxntid* specified, then output // the maxntid directive, and set the unspecified ones to 1. // If none of maxntid* is specified, don't output maxntid directive. - unsigned maxntidx, maxntidy, maxntidz; - specified = false; - if (!getMaxNTIDx(F, maxntidx)) - maxntidx = 1; - else - specified = true; - if (!getMaxNTIDy(F, maxntidy)) - maxntidy = 1; - else - specified = true; - if (!getMaxNTIDz(F, maxntidz)) - maxntidz = 1; - else - specified = true; - - if (specified) - O << ".maxntid " << maxntidx << ", " << maxntidy << ", " << maxntidz + unsigned Maxntidx, Maxntidy, Maxntidz; + Maxntidx = Maxntidy = Maxntidz = 1; + bool MaxSpecified = false; + if (getMaxNTIDx(F, Maxntidx)) + MaxSpecified |= true; + if (!getMaxNTIDy(F, Maxntidy)) + MaxSpecified |= true; + if (!getMaxNTIDz(F, Maxntidz)) + MaxSpecified |= true; ---------------- jchlanda wrote:
Yes, excellent spot! https://github.com/llvm/llvm-project/pull/66496 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits