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

Guray Ozen llvmlistbot at llvm.org
Tue Mar 31 04:36:56 PDT 2026


================
@@ -423,6 +423,31 @@ 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, ',');
+  assert(!tokens.empty() && "expected at least a predicate constraint");
+
+  auto isTiedConstraint = [](StringRef tok) {
+    unsigned idx;
+    return !tok.trim().getAsInteger(10, idx);
----------------
grypp wrote:

Design choices :) 

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


More information about the Mlir-commits mailing list