[Mlir-commits] [mlir] [MLIR][NVVM] Fix predicate operand index in BasicPtxBuilderInterface (PR #189552)

Guray Ozen llvmlistbot at llvm.org
Tue Mar 31 04:11:54 PDT 2026


================
@@ -423,6 +423,24 @@ static std::string rewriteAsmPlaceholders(llvm::StringRef ptxCode) {
   return out;
 }
 
+/// Return the constraint index of the predicate operand.  The predicate
+/// constraint ("b") is always the last non-tied token in the canonicalized
+/// constraint string.  Tied constraints (digit-only tokens from read-write
+/// canonicalization) are appended at the end, so we walk backwards to skip
+/// them.
+static unsigned getPredicateConstraintIndex(StringRef constraints) {
+  SmallVector<StringRef> tokens;
+  constraints.split(tokens, ',');
+  unsigned numTied = 0;
+  for (auto it = tokens.rbegin(); it != tokens.rend(); ++it) {
+    unsigned id;
+    if (it->trim().getAsInteger(10, id))
----------------
grypp wrote:

added more complex test

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


More information about the Mlir-commits mailing list