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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 06:50:56 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()) {
----------------
lukel97 wrote:

Not that I'm aware of, but I'll add an assert that. i.e. that if an op is tied, it's the first operand and it's tied to the def.

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


More information about the llvm-commits mailing list