[llvm] [TargetLowering] Deduplicate choosing InlineAsm constraint between ISels (PR #67057)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 01:43:55 PDT 2023


================
@@ -5879,7 +5878,19 @@ void TargetLowering::ComputeConstraintToUse(AsmOperandInfo &OpInfo,
     OpInfo.ConstraintCode = OpInfo.Codes[0];
     OpInfo.ConstraintType = getConstraintType(OpInfo.ConstraintCode);
   } else {
-    ChooseConstraint(OpInfo, *this, Op, DAG);
+    ConstraintGroup G = getConstraintPreferences(OpInfo);
+    if (G.empty())
+      return;
+
+    unsigned BestIdx = 0;
+    while (!lowerImmediateIfPossible(G[BestIdx], Op, DAG, *this)) {
----------------
qcolombet wrote:

```suggestion
    
    for (unsigned end = G.size(); BestIdx != end && !lowerImmediateIfPossible(G[BestIdx], Op, DAG, *this), ++BestIdx) {}
    
    if (BestIdx == end)
      return;
```

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


More information about the llvm-commits mailing list