[llvm] [RISCV][VLOPT] Allow users that are passthrus if tail elements aren't demanded (PR #124066)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 06:48:27 PST 2025


================
@@ -1235,16 +1236,21 @@ std::optional<MachineOperand> RISCVVLOptimizer::checkUsers(MachineInstr &MI) {
       return std::nullopt;
     }
 
-    // Tied operands might pass through.
-    if (UserOp.isTied()) {
-      LLVM_DEBUG(dbgs() << "    Abort because user used as tied operand\n");
-      return std::nullopt;
-    }
-
     auto VLOp = getMinimumVLForUser(UserOp);
     if (!VLOp)
       return std::nullopt;
 
+    // If the user is a passthru, we will need to preserve it if its tail is
+    // demanded.
+    if (UserOp.isTied()) {
----------------
michaelmaitland wrote:

Is it possible for UserOp to be a non-passthru tied def? If so, do we need to check `RISCVII::isFirstDefTiedToFirstUse(UserOp.getParent().getDesc());`?

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


More information about the llvm-commits mailing list