Skip to content

[ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes #86149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

SLTozer
Copy link
Contributor

@SLTozer SLTozer commented Mar 21, 2024

This patch is part of a set of patches that add an -fextend-lifetimes flag to clang, which extends the lifetimes of local variables and parameters for improved debuggability. In addition to that flag, the patch series adds a pragma to selectively disable -fextend-lifetimes, and an -fextend-this-ptr flag which functions as -fextend-lifetimes for this pointers only. All changes and tests in these patches were written by @wolfy1961, though I will be managing these reviews and addressing any comments raised. The extend lifetimes flag is intended to eventually be set on by -Og, as discussed in the RFC here.


This patch implements a new intrinsic instruction in LLVM, llvm.fake.use in IR and FAKE_USE in MIR, that takes a single operand and has no effect other than "using" its operand, to ensure that its operand remains live until after the fake use. This patch does not emit fake uses anywhere; the next patch in this sequence causes them to be emitted from the clang frontend, such that for each variable (or this) a fake.use operand is inserted at the end of that variable's scope, using that variable's value. This patch covers everything post-frontend, which is largely just the basic plumbing for a new intrinsic/instruction, along with a few steps to preserve the fake uses through optimizations (such as moving them ahead of a tail call or translating them through SROA).

@llvmbot
Copy link
Member

llvmbot commented Mar 21, 2024

@llvm/pr-subscribers-backend-spir-v
@llvm/pr-subscribers-backend-webassembly
@llvm/pr-subscribers-backend-powerpc
@llvm/pr-subscribers-backend-nvptx
@llvm/pr-subscribers-llvm-globalisel
@llvm/pr-subscribers-llvm-support
@llvm/pr-subscribers-llvm-analysis
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-llvm-ir

Author: Stephen Tozer (SLTozer)

Changes

This patch is part of a set of patches that add an -fextend-lifetimes flag to clang, which extends the lifetimes of local variables and parameters for improved debuggability. In addition to that flag, the patch series adds a pragma to selectively disable -fextend-lifetimes, and an -fextend-this-ptr flag which functions as -fextend-lifetimes for this pointers only. All changes and tests in these patches were written by @wolfy1961, though I will be managing these reviews and addressing any comments raised. The extend lifetimes flag is intended to eventually be set on by -Og, as discussed in the RFC here.


This patch implements a new intrinsic instruction in LLVM, llvm.fake.use in IR and FAKE_USE in MIR, that takes a single operand and has no effect other than "using" its operand, to ensure that its operand remains live until after the fake use. This patch does not emit fake uses anywhere; the next patch in this sequence causes them to be emitted from the clang frontend, such that for each variable (or this) a fake.use operand is inserted at the end of that variable's scope, using that variable's value. This patch covers everything post-frontend, which is largely just the basic plumbing for a new intrinsic/instruction, along with a few steps to preserve the fake uses through optimizations (such as moving them ahead of a tail call or translating them through SROA).


Patch is 75.72 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/86149.diff

46 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+36)
  • (modified) llvm/include/llvm/Analysis/PtrUseVisitor.h (+1)
  • (modified) llvm/include/llvm/CodeGen/ISDOpcodes.h (+5)
  • (modified) llvm/include/llvm/CodeGen/MachineInstr.h (+2)
  • (modified) llvm/include/llvm/CodeGen/SelectionDAGISel.h (+1)
  • (modified) llvm/include/llvm/IR/Intrinsics.td (+3)
  • (modified) llvm/include/llvm/Support/TargetOpcodes.def (+3)
  • (modified) llvm/include/llvm/Target/Target.td (+8)
  • (modified) llvm/lib/CodeGen/Analysis.cpp (+2-1)
  • (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+43)
  • (modified) llvm/lib/CodeGen/CodeGenPrepare.cpp (+40-2)
  • (modified) llvm/lib/CodeGen/DeadMachineInstructionElim.cpp (+2-1)
  • (modified) llvm/lib/CodeGen/MachineCSE.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/MachineScheduler.cpp (+2-1)
  • (modified) llvm/lib/CodeGen/SelectionDAG/FastISel.cpp (+3)
  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (+20)
  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (+19)
  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h (+7)
  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (+11)
  • (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (+36-1)
  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (+18)
  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (+2)
  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (+64)
  • (modified) llvm/lib/IR/Instruction.cpp (+4-1)
  • (modified) llvm/lib/IR/Verifier.cpp (+1)
  • (modified) llvm/lib/Target/X86/X86FloatingPoint.cpp (+32)
  • (modified) llvm/lib/Transforms/Scalar/SROA.cpp (+30)
  • (modified) llvm/lib/Transforms/Utils/CloneFunction.cpp (+6)
  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+3)
  • (modified) llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (+2-1)
  • (added) llvm/test/CodeGen/MIR/X86/fake-use-phi.mir (+95)
  • (added) llvm/test/CodeGen/MIR/X86/fake-use-scheduler.mir (+115)
  • (added) llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir (+106)
  • (added) llvm/test/CodeGen/MIR/X86/fake-use-zero-length.ll (+40)
  • (added) llvm/test/CodeGen/X86/fake-use-hpfloat.ll (+17)
  • (added) llvm/test/CodeGen/X86/fake-use-ld.ll (+51)
  • (added) llvm/test/CodeGen/X86/fake-use-simple-tail-call.ll (+33)
  • (added) llvm/test/CodeGen/X86/fake-use-split-ret.ll (+53)
  • (added) llvm/test/CodeGen/X86/fake-use-sroa.ll (+54)
  • (added) llvm/test/CodeGen/X86/fake-use-suppress-load.ll (+23)
  • (added) llvm/test/CodeGen/X86/fake-use-tailcall.ll (+23)
  • (added) llvm/test/CodeGen/X86/fake-use-vector.ll (+45)
  • (added) llvm/test/CodeGen/X86/fake-use-vector2.ll (+33)
  • (added) llvm/test/DebugInfo/X86/Inputs/check-fake-use.py (+100)
  • (added) llvm/test/DebugInfo/X86/fake-use.ll (+98)
  • (added) llvm/test/Transforms/GVN/fake-use-constprop.ll (+69)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 8bc1cab01bf0a6..e7b8af3a2116c7 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -27896,6 +27896,42 @@ execution, but is unknown at compile time.
 If the result value does not fit in the result type, then the result is
 a :ref:`poison value <poisonvalues>`.
 
+.. _llvm_fake_use:
+
+'``llvm.fake.use``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+      declare void @llvm.fake.use(...)
+
+Overview:
+"""""""""
+
+The ``llvm.fake.use`` intrinsic is a no-op. It takes a single
+value as an operand and is treated as a use of that operand, to force the
+optimizer to preserve that value prior to the fake use. This is used for
+extending the lifetimes of variables, where this intrinsic placed at the end of
+a variable's scope helps prevent that variable from being optimized out.
+
+Arguments:
+""""""""""
+
+The ``llvm.fake.use`` intrinsic takes one argument, which may be any
+function-local SSA value. Note that the signature is variadic so that the
+intrinsic can take any type of argument, but passing more than one argument will
+result in an error.
+
+Semantics:
+""""""""""
+
+This intrinsic does nothing, but optimizers must consider it a use of its single
+operand and should try to preserve the intrinsic and its position in the
+function.
+
 
 Stack Map Intrinsics
 --------------------
diff --git a/llvm/include/llvm/Analysis/PtrUseVisitor.h b/llvm/include/llvm/Analysis/PtrUseVisitor.h
index 86206b2d5e9f88..4e46d441fce17e 100644
--- a/llvm/include/llvm/Analysis/PtrUseVisitor.h
+++ b/llvm/include/llvm/Analysis/PtrUseVisitor.h
@@ -279,6 +279,7 @@ class PtrUseVisitor : protected InstVisitor<DerivedT>,
     default:
       return Base::visitIntrinsicInst(II);
 
+    case Intrinsic::fake_use:
     case Intrinsic::lifetime_start:
     case Intrinsic::lifetime_end:
       return; // No-op intrinsics.
diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h
index 49d51a27e3c0f6..43aa02b5b03762 100644
--- a/llvm/include/llvm/CodeGen/ISDOpcodes.h
+++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h
@@ -1304,6 +1304,11 @@ enum NodeType {
   LIFETIME_START,
   LIFETIME_END,
 
+  /// FAKE_USE represents a use of the operand but does not do anything.
+  /// Its purpose is the extension of the operand's lifetime mainly for
+  /// debugging purposes.
+  FAKE_USE,
+
   /// GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the
   /// beginning and end of GC transition  sequence, and carry arbitrary
   /// information that target might need for lowering.  The first operand is
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index fcdd73d8b65fdd..163bcf6aa5a1a2 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -1401,6 +1401,8 @@ class MachineInstr
     return getOpcode() == TargetOpcode::EXTRACT_SUBREG;
   }
 
+  bool isFakeUse() const { return getOpcode() == TargetOpcode::FAKE_USE; }
+
   /// Return true if the instruction behaves like a copy.
   /// This does not include native copy instructions.
   bool isCopyLike() const {
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
index 837f8bf7263ea9..cb8dec554a57b6 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
@@ -453,6 +453,7 @@ class SelectionDAGISel : public MachineFunctionPass {
   void Select_READ_REGISTER(SDNode *Op);
   void Select_WRITE_REGISTER(SDNode *Op);
   void Select_UNDEF(SDNode *N);
+  void Select_FAKE_USE(SDNode *N);
   void CannotYetSelect(SDNode *N);
 
   void Select_FREEZE(SDNode *N);
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 091f9b38107989..23a9f586056267 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1778,6 +1778,9 @@ def int_is_constant : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_any_ty],
                                 [IntrNoMem, IntrWillReturn, IntrConvergent],
                                 "llvm.is.constant">;
 
+// Introduce a use of the argument without generating any code.
+def int_fake_use : Intrinsic<[], [llvm_vararg_ty]>;
+
 // Intrinsic to mask out bits of a pointer.
 // First argument must be pointer or vector of pointer. This is checked by the
 // verifier.
diff --git a/llvm/include/llvm/Support/TargetOpcodes.def b/llvm/include/llvm/Support/TargetOpcodes.def
index 899eaad5842ae0..9797bbe02a9b5c 100644
--- a/llvm/include/llvm/Support/TargetOpcodes.def
+++ b/llvm/include/llvm/Support/TargetOpcodes.def
@@ -217,6 +217,9 @@ HANDLE_TARGET_OPCODE(PATCHABLE_TYPED_EVENT_CALL)
 
 HANDLE_TARGET_OPCODE(ICALL_BRANCH_FUNNEL)
 
+/// Represents a use of the operand but generates no code.
+HANDLE_TARGET_OPCODE(FAKE_USE)
+
 // This is a fence with the singlethread scope. It represents a compiler memory
 // barrier, but does not correspond to any generated instruction.
 HANDLE_TARGET_OPCODE(MEMBARRIER)
diff --git a/llvm/include/llvm/Target/Target.td b/llvm/include/llvm/Target/Target.td
index cb1c0ed2513d45..2f5d9a5b8ea877 100644
--- a/llvm/include/llvm/Target/Target.td
+++ b/llvm/include/llvm/Target/Target.td
@@ -1401,6 +1401,14 @@ def FAULTING_OP : StandardPseudoInstruction {
   let isTerminator = true;
   let isBranch = true;
 }
+def FAKE_USE : StandardPseudoInstruction {
+  // An instruction that uses its operands but does nothing.
+  let OutOperandList = (outs);
+  let InOperandList = (ins variable_ops);
+  let AsmString = "FAKE_USE";
+  let hasSideEffects = 0;
+  let isMeta = true;
+}
 def PATCHABLE_OP : StandardPseudoInstruction {
   let OutOperandList = (outs);
   let InOperandList = (ins variable_ops);
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index af7643d93591f7..05840c963ea526 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -566,7 +566,8 @@ bool llvm::isInTailCallPosition(const CallBase &Call, const TargetMachine &TM) {
     if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(BBI))
       if (II->getIntrinsicID() == Intrinsic::lifetime_end ||
           II->getIntrinsicID() == Intrinsic::assume ||
-          II->getIntrinsicID() == Intrinsic::experimental_noalias_scope_decl)
+          II->getIntrinsicID() == Intrinsic::experimental_noalias_scope_decl ||
+          II->getIntrinsicID() == Intrinsic::fake_use)
         continue;
     if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() ||
         !isSafeToSpeculativelyExecute(&*BBI))
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index a15538755d73b3..1e680630e6cb58 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1099,11 +1099,46 @@ void AsmPrinter::emitFunctionEntryLabel() {
   }
 }
 
+// Recognize cases where a spilled register is reloaded solely to feed into a
+// FAKE_USE.
+static bool isLoadFeedingIntoFakeUse(const MachineInstr &MI) {
+  const MachineFunction *MF = MI.getMF();
+  const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
+
+  // If the restore size is std::nullopt then we are not dealing with a reload
+  // of a spilled register.
+  if (!MI.getRestoreSize(TII))
+    return false;
+
+  // Check if this register is the operand of a FAKE_USE and
+  // does it have the kill flag set there.
+  auto NextI = std::next(MI.getIterator());
+  if (NextI == MI.getParent()->end() || !NextI->isFakeUse())
+    return false;
+
+  unsigned Reg = MI.getOperand(0).getReg();
+  for (const MachineOperand &MO : NextI->operands()) {
+    // Return true if we came across the register from the
+    // previous spill instruction that is killed in NextI.
+    if (MO.isReg() && MO.isUse() && MO.isKill() && MO.getReg() == Reg)
+      return true;
+  }
+
+  return false;
+}
+
 /// emitComments - Pretty-print comments for instructions.
 static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
   const MachineFunction *MF = MI.getMF();
   const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
 
+  // If this is a reload of a spilled register that only feeds into a FAKE_USE
+  // instruction, meaning the load value has no effect on the program and has
+  // only been kept alive for debugging; since it is still available on the
+  // stack, we can skip the load itself.
+  if (isLoadFeedingIntoFakeUse(MI))
+    return;
+
   // Check for spills and reloads
 
   // We assume a single instruction only has a spill or reload, not
@@ -1828,6 +1863,8 @@ void AsmPrinter::emitFunctionBody() {
       case TargetOpcode::KILL:
         if (isVerbose()) emitKill(&MI, *this);
         break;
+      case TargetOpcode::FAKE_USE:
+        break;
       case TargetOpcode::PSEUDO_PROBE:
         emitPseudoProbe(MI);
         break;
@@ -1843,6 +1880,12 @@ void AsmPrinter::emitFunctionBody() {
         // purely meta information.
         break;
       default:
+        // If this is a reload of a spilled register that only feeds into a
+        // FAKE_USE instruction, meaning the load value has no effect on the
+        // program and has only been kept alive for debugging; since it is
+        // still available on the stack, we can skip the load itself.
+        if (isLoadFeedingIntoFakeUse(MI))
+          break;
         emitInstruction(&MI);
         if (CanDoExtraAnalysis) {
           MCInst MCI;
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 9f99bb7e693f7e..a2314779c8e687 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2663,12 +2663,34 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
     return false;
   };
 
+  SmallVector<const IntrinsicInst *, 4> FakeUses;
+
+  auto isFakeUse = [&FakeUses](const Instruction *Inst) {
+    if (auto *II = dyn_cast<IntrinsicInst>(Inst);
+        II && II->getIntrinsicID() == Intrinsic::fake_use) {
+      // Record the instruction so it can be preserved when the exit block is
+      // removed. Do not preserve the fake use that uses the result of the
+      // PHI instruction.
+      // Do not copy fake uses that use the result of a PHI node.
+      // FIXME: If we do want to copy the fake use into the return blocks, we
+      // have to figure out which of the PHI node operands to use for each
+      // copy.
+      if (!isa<PHINode>(II->getOperand(0))) {
+        FakeUses.push_back(II);
+      }
+      return true;
+    }
+
+    return false;
+  };
+
   // Make sure there are no instructions between the first instruction
   // and return.
   const Instruction *BI = BB->getFirstNonPHI();
   // Skip over debug and the bitcast.
   while (isa<DbgInfoIntrinsic>(BI) || BI == BCI || BI == EVI ||
-         isa<PseudoProbeInst>(BI) || isLifetimeEndOrBitCastFor(BI))
+         isa<PseudoProbeInst>(BI) || isLifetimeEndOrBitCastFor(BI) ||
+         isFakeUse(BI))
     BI = BI->getNextNode();
   if (BI != RetI)
     return false;
@@ -2677,6 +2699,7 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
   /// call.
   const Function *F = BB->getParent();
   SmallVector<BasicBlock *, 4> TailCallBBs;
+  SmallVector<CallInst *, 4> CallInsts;
   if (PN) {
     for (unsigned I = 0, E = PN->getNumIncomingValues(); I != E; ++I) {
       // Look through bitcasts.
@@ -2710,6 +2733,9 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
             attributesPermitTailCall(F, CI, RetI, *TLI))
           TailCallBBs.push_back(PredBB);
       }
+      // Record the call instruction so we can insert any fake uses
+      // that need to be preserved before it.
+      CallInsts.push_back(CI);
     }
   } else {
     SmallPtrSet<BasicBlock *, 4> VisitedBBs;
@@ -2726,6 +2752,9 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
               (isIntrinsicOrLFToBeTailCalled(TLInfo, CI) &&
                V == CI->getArgOperand(0))) {
             TailCallBBs.push_back(Pred);
+            // Record the call instruction so we can insert any fake uses
+            // that need to be preserved before it.
+            CallInsts.push_back(CI);
           }
         }
       }
@@ -2752,8 +2781,17 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
   }
 
   // If we eliminated all predecessors of the block, delete the block now.
-  if (Changed && !BB->hasAddressTaken() && pred_empty(BB))
+  if (Changed && !BB->hasAddressTaken() && pred_empty(BB)) {
+    // Copy the fake uses found in the original return block to all blocks
+    // that contain tail calls.
+    for (auto *CI : CallInsts) {
+      for (auto const *FakeUse : FakeUses) {
+        auto *ClonedInst = FakeUse->clone();
+        ClonedInst->insertBefore(CI);
+      }
+    }
     BB->eraseFromParent();
+  }
 
   return Changed;
 }
diff --git a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
index facc01452d2f12..468949fd4cf498 100644
--- a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
+++ b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
@@ -87,7 +87,8 @@ bool DeadMachineInstructionElimImpl::isDead(const MachineInstr *MI) const {
     return false;
 
   // Don't delete frame allocation labels.
-  if (MI->getOpcode() == TargetOpcode::LOCAL_ESCAPE)
+  if (MI->getOpcode() == TargetOpcode::LOCAL_ESCAPE ||
+      MI->getOpcode() == TargetOpcode::FAKE_USE)
     return false;
 
   // Don't delete instructions with side effects.
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 26a8d00e662651..c3c7f48677d5c2 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -406,7 +406,7 @@ bool MachineCSE::PhysRegDefsReach(MachineInstr *CSMI, MachineInstr *MI,
 
 bool MachineCSE::isCSECandidate(MachineInstr *MI) {
   if (MI->isPosition() || MI->isPHI() || MI->isImplicitDef() || MI->isKill() ||
-      MI->isInlineAsm() || MI->isDebugInstr() || MI->isJumpTableDebugInfo())
+      MI->isInlineAsm() || MI->isDebugInstr() || MI->isJumpTableDebugInfo() || MI->isFakeUse())
     return false;
 
   // Ignore copies.
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 0d5bf329938781..1cc611107e5984 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -524,7 +524,8 @@ static bool isSchedBoundary(MachineBasicBlock::iterator MI,
                             MachineBasicBlock *MBB,
                             MachineFunction *MF,
                             const TargetInstrInfo *TII) {
-  return MI->isCall() || TII->isSchedulingBoundary(*MI, MBB, *MF);
+  return MI->isCall() || TII->isSchedulingBoundary(*MI, MBB, *MF) ||
+         MI->isFakeUse();
 }
 
 /// A region of an MBB for scheduling.
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 27b8472ddb73d8..5451abcdfcf9d2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1461,6 +1461,9 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
     updateValueMap(II, ResultReg);
     return true;
   }
+  case Intrinsic::fake_use:
+    // At -O0, we don't need fake use, so just ignore it.
+    return true;
   case Intrinsic::experimental_stackmap:
     return selectStackmap(II);
   case Intrinsic::experimental_patchpoint_void:
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index 3332c02ec72358..ac1242ff59f164 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -2229,6 +2229,9 @@ bool DAGTypeLegalizer::PromoteFloatOperand(SDNode *N, unsigned OpNo) {
       report_fatal_error("Do not know how to promote this operator's operand!");
 
     case ISD::BITCAST:    R = PromoteFloatOp_BITCAST(N, OpNo); break;
+    case ISD::FAKE_USE:
+      R = PromoteFloatOp_FAKE_USE(N, OpNo);
+      break;
     case ISD::FCOPYSIGN:  R = PromoteFloatOp_FCOPYSIGN(N, OpNo); break;
     case ISD::FP_TO_SINT:
     case ISD::FP_TO_UINT:
@@ -2268,6 +2271,13 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_BITCAST(SDNode *N, unsigned OpNo) {
   return DAG.getBitcast(N->getValueType(0), Convert);
 }
 
+SDValue DAGTypeLegalizer::PromoteFloatOp_FAKE_USE(SDNode *N, unsigned OpNo) {
+  assert(OpNo == 1 && "Only Operand 1 must need promotion here");
+  SDValue Op = GetPromotedFloat(N->getOperand(OpNo));
+  return DAG.getNode(N->getOpcode(), SDLoc(N), MVT::Other, N->getOperand(0),
+                     Op);
+}
+
 // Promote Operand 1 of FCOPYSIGN.  Operand 0 ought to be handled by
 // PromoteFloatRes_FCOPYSIGN.
 SDValue DAGTypeLegalizer::PromoteFloatOp_FCOPYSIGN(SDNode *N, unsigned OpNo) {
@@ -3138,6 +3148,9 @@ bool DAGTypeLegalizer::SoftPromoteHalfOperand(SDNode *N, unsigned OpNo) {
                        "operand!");
 
   case ISD::BITCAST:    Res = SoftPromoteHalfOp_BITCAST(N); break;
+  case ISD::FAKE_USE:
+    Res = SoftPromoteHalfOp_FAKE_USE(N, OpNo);
+    break;
   case ISD::FCOPYSIGN:  Res = SoftPromoteHalfOp_FCOPYSIGN(N, OpNo); break;
   case ISD::FP_TO_SINT:
   case ISD::FP_TO_UINT: Res = SoftPromoteHalfOp_FP_TO_XINT(N); break;
@@ -3175,6 +3188,13 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfOp_BITCAST(SDNode *N) {
   return DAG.getNode(ISD::BITCAST, SDLoc(N), N->getValueType(0), Op0);
 }
 
+SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FAKE_USE(SDNode *N, unsigned OpNo) {
+  assert(OpNo == 1 && "Only Operand 1 must need promotion here");
+  SDValue Op = GetSoftPromotedHalf(N->getOperand(OpNo));
+  return DAG.getNode(N->getOpcode(), SDLoc(N), MVT::Other, N->getOperand(0),
+                     Op);
+}
+
 SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FCOPYSIGN(SDNode *N,
                                                       unsigned OpNo) {
   assert(OpNo == 1 && "Only Operand 1 must need promotion here");
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 93ce9c22af5525..022cb9a4a82cdc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1818,6 +1818,9 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {
   case ISD::BUILD_VECTOR: Res = PromoteIntOp_BUILD_VECTOR(N); break;
   case ISD::CONCAT_VECTORS: Res = PromoteIntOp_CONCAT_VECTORS(N); break;
   case ISD::EXTRACT_VECTOR_ELT: Res = PromoteIntOp_EXTRACT_VECTOR_ELT(N); break;
+  case ISD::FAKE_USE:
+    Res = PromoteIntOp_FAKE_USE(N);
+    break;
   case ISD::INSERT_VECTOR_ELT:
     Res = PromoteIntOp_INSERT_VECTOR_ELT(N, OpNo);
     break;
@@ -5124,6 +5127,9 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) {
   case ISD::BR_CC:             Res = ExpandIntOp_BR_CC(N); break;
   case ISD::BUILD_VECTOR:      Res = ExpandOp_BUILD_VECTOR(N); break;
   case ISD::EXTRACT_ELEMENT:   Res = ExpandOp_EXTRACT_ELEMENT(N); break;
+  case ISD::FAKE_USE:
+    Res = ExpandOp_FAKE_USE(N);
+    break;
   case ISD::INSERT_VECTOR_ELT: Res = ExpandOp_INSERT_VECTOR_ELT(N); break;
   case ISD::SCALAR_TO_VECTOR:  Res = ExpandOp_SCALAR_TO_VECTOR(N); break;
   case ISD::SPLAT_VECTOR:      Res = ExpandIntOp_SPLAT_VECTOR(N); break;
@@ -5931,6 +5937,19 @@ SDValue DAGTypeLegalizer::PromoteIntOp_INSERT_SUBVECTOR(SDNode *N) {
   return DAG.getAnyExtOrTrunc(Ext, dl, N->getValueType(0));
 }
 
+// FIXME: We wouldn't need this if clang could promote short integers
+// that are arguments to FAKE_USE.
+SDValue DAGTypeLegalizer::PromoteIntOp_FAKE_USE(SDNode *N) {
+  SDLoc dl(N);
+  SDValue V0 = N->getOperand(0);
+  SDValue V1 = N->getOperand(1);
+  EVT InVT1 = V1.getValueType();
+  SDValue VPromoted =
+      DAG.getNode(ISD::ANY_EXTEND, dl,
+                  TLI.getTypeToTransformTo(*DAG.getContext(), InVT1), V1);
+  return DAG.getNode(N->getOpcode(), dl, N->getValueType(0), V0, VPromoted);
+}
+
 SDValue DAGTypeLegalizer::PromoteIntOp_EXTRACT_SUBVECTOR(SDNode *N) {
   SDLoc dl(N);
   SDValue V0 = GetPromotedInteger(N->getOperand(0));
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index e08acd36b41d4e..6a3f76ae4b6ded 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/llvm/lib/CodeG...
[truncated]

Copy link

github-actions bot commented Mar 21, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@felipepiovezan
Copy link
Contributor

I only skimmed the diff, but noticed there is no global isel lowering here. Were there any challenges in doing that or was it not considered?

@pogo59
Copy link
Collaborator

pogo59 commented Mar 21, 2024

I only skimmed the diff, but noticed there is no global isel lowering here. Were there any challenges in doing that or was it not considered?

Our target of interest is X86, so I believe it was not considered. @wolfy1961 can correct me if I'm mis-remembering.

@SLTozer
Copy link
Contributor Author

SLTozer commented Mar 21, 2024

I only skimmed the diff, but noticed there is no global isel lowering here. Were there any challenges in doing that or was it not considered?

I wasn't the original patch writer, but I think it would be the latter. I'm not familiar with the internals of GlobalISel, so I'm not sure how confident I'd be implementing support for fake use there myself - though FWIW, since it's a no-op it's mostly just filling in the boilerplate, with a few more complex cases (such as moving fake uses before tail calls).

@felipepiovezan
Copy link
Contributor

felipepiovezan commented Mar 21, 2024

I only skimmed the diff, but noticed there is no global isel lowering here. Were there any challenges in doing that or was it not considered?

I wasn't the original patch writer, but I think it would be the latter. I'm not familiar with the internals of GlobalISel, so I'm not sure how confident I'd be implementing support for fake use there myself - though FWIW, since it's a no-op it's mostly just filling in the boilerplate, with a few more complex cases (such as moving fake uses before tail calls).

The reason I asked is -- and I could be wrong -- that GlobalISel will give up and fall back to SelectionDAG when it seems something it doesn't know how to lower. That usually happens in IRTranslator.cpp:

        if (translate(Inst))
          continue;

        ...
        reportTranslationError(*MF, *TPC, *ORE, R);
        return false;
      }

So, depending on how/when these intrinsics are generated, this patch could affect a few different targets.

edit: not this patch, but the one that would generate the intrinsics

@adrian-prantl
Copy link
Collaborator

So, depending on how/when these intrinsics are generated, this patch could affect a few different targets.

And it would introduce a situation we usually try to avoid: the presence of debug info could significantly change code generation.

@wolfy1961
Copy link
Collaborator

I only skimmed the diff, but noticed there is no global isel lowering here. Were there any challenges in doing that or was it not considered?

IIRC, the original patch predated Global Isel, or else it was in a very early stage at the time, so it was simply not considered.

Our target of interest is X86, so I believe it was not considered. @wolfy1961 can correct me if I'm mis-remembering.

The patch wasn't meant to be specific to any target, although our efforts were concentrating on X86.

@SLTozer
Copy link
Contributor Author

SLTozer commented Mar 21, 2024

So, depending on how/when these intrinsics are generated, this patch could affect a few different targets.

Interesting; I think falling back on SelectionDAG would produce a relatively normal result (emitting FAKE_USE), but hard to say whether there would be any knock-on effects. In the worst case scenario we could just drop fake uses in GlobalISel - it should be safe to do so, since the intrinsics themselves are no-ops, it just means that the values will no longer be protected from the start of ISel onwards.

And it would introduce a situation we usually try to avoid: the presence of debug info could significantly change code generation.

This intrinsic has no technical relation to debug info; the purpose is to improve debug info quality when enabled, but the codegen effects of this flag are unrelated to whether debug info is emitted or not; if you use -fextend-lifetimes without -g, you'll prevent optimizations that would have harmed debug info even when that debug info isn't present.

@wolfy1961
Copy link
Collaborator

So, depending on how/when these intrinsics are generated, this patch could affect a few different targets.

And it would introduce a situation we usually try to avoid: the presence of debug info could significantly change code generation.

Conceptually, though, extend-lifetimes is purely a codegen change. It could stand on its own, even though it would only be useful to improve debuggability. I think it's important to separate the 2 concepts. Debug info generation by itself does not trigger extend-lifetimes unless we specifically also request extend-lifetimes as well.

@felipepiovezan
Copy link
Contributor

Interesting; I think falling back on SelectionDAG would produce a relatively normal result (emitting FAKE_USE),

To clarify, the entire function would be skipped by GlobalISEL, not just the lowering of one instruction.

@felipepiovezan
Copy link
Contributor

Conceptually, though, extend-lifetimes is purely a codegen change. It could stand on its own, even though it would only be useful to improve debuggability. I think it's important to separate the 2 concepts. Debug info generation by itself does not trigger extend-lifetimes unless we specifically also request extend-lifetimes as well.

Isn't the following statement contradicting the above?

The extend lifetimes flag is intended to eventually be set on by -Og

@SLTozer
Copy link
Contributor Author

SLTozer commented Mar 21, 2024

To clarify, the entire function would be skipped by GlobalISEL, not just the lowering of one instruction.

Ah, I misunderstood - in which case forcing it to be dropped until a complete implementation is present would be preferable.

Isn't the following statement contradicting the above?

-Og is also purely a codegen change, it doesn't control whether or not debug info is emitted; in both cases, we're telling the compiler to change codegen to be better for debugging.

@arsenm
Copy link
Contributor

arsenm commented Mar 22, 2024

Passing through a pseudo through globalisel should be trivial; it will just need legalization handling approximately equivalent to whatever every target does for G_IMPLICIT_DEF

@SLTozer SLTozer requested a review from andreil99 April 16, 2024 16:07
Copy link
Contributor

@OCHyams OCHyams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked over the code and test changes. The contents and style LGTM overall (some minor inline comments). I'm not familiar with the legalizer or X86FloatingPoint.cpp, so if someone could take a look at those parts specifically that would be great (or @arsenm have you looked at those bits already?).

Once that has been done, and once GlobalISel support has been added, I think that's everything covered by review.

I also work at Sony so I'm hesitant to Accept this once those bits have been done (I know that I am "allowed" to, but for a larger feature it feels right if others are involved too).

For added confidence, it should also be noted that the functionality has been working well for us downstream for over 5 years (possibly 7 years, but I haven't done much archeology on it) - we work at tot and we've been maintaining it since, so we know it works with today's LLVM. The feature was first mentioned upstream all the way back in 2015, here https://lists.llvm.org/pipermail/llvm-dev/2015-September/090610.html. That is all to say, as far as "new" features go this one has gone through a lot of real-world testing.

The feature this patch supports (-fextend-lifetimes, and improving the -Og pipeline to bring substantial debugging benefits) was discussed at EuroLLVM 2024 - many people seemed to support this idea and I didn't see anyone one raised any objection to it.

# We make sure that, beginning with the first FAKE_USE instruction,
# no changes to the sequence of instructions are undertaken by the
# scheduler. We don't bother to check that the order of the FAKE_USEs
# remains the same. They should, but it is irrelevant.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feels like this test has the potential to be able to be a rotten green test (i.e., what's to say that the scheduler would move things past the FAKE_USE anyway?). Possibly solvable with some creative sed-ing? I'm unsure.

; REQUIRES: object-emission

; Make sure the fake use of 'b' at the end of 'foo' causes location information for 'b'
; to extend all the way to the end of the function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an ideal world, we'd probably want to also check that not-using fake-uses results in b not extending to the end of the function, to prevent rotten green tests. Might be a bit fiddly though. wdyt, is it possible?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making something that pretty firmly forces optimizations that would reuse the storage shouldn't be too hard...

@@ -0,0 +1,100 @@
# Parsing dwarfdump's output to determine whether the location list for the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm not fully understanding this use case, but can't we replicate these checks with filecheck instead? IMO that would be cleaner than introducing some special equipment, if we can avoid it. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree in principle, the reason it's done here though is that the fake use can't guarantee liveness to the very end of the function, and so we can correctly lose "b" before a copy+return at the end of the function. The script adjusts for this by allowing a small numeric difference between the end of b's live range and the subprogram high PC; the way that I've updated the test to not be rotten means that right now b's live range extends to the end of the function, so if that's good enough for now then I can rewrite this to use FileCheck.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it works right now, and reasonably can continue to do so for the specific example being tested - I'd keep it simple/test it exactly. If there's a specific case where we can't get the whole range - maybe add a test for that and, agian, test the exact behavior with a note "this doesn't extend to the very end of the function, and that's OK or that's a known limitation, or that's a known bug (with link to the bug)"

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/4173

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -run-pass=codegenprepare -o - /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -run-pass=codegenprepare -o - /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/4175

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -run-pass=codegenprepare -o - /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -run-pass=codegenprepare -o - /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@SLTozer
Copy link
Contributor Author

SLTozer commented Aug 29, 2024

Looks like an explicit triple is needed for some of the tests (should probably go on all of them, but for now I'll just add it to the tests that are failing).

SLTozer added a commit that referenced this pull request Aug 29, 2024
Several tests for the new fake use intrinsic are failing on NVPTX
buildbots due to relying on behaviour for their expected triple;
this commit adds that triple to each of them to prevent failures.

Fixes commit 3d08ade (#86149).

Example buildbot failures:
https://lab.llvm.org/buildbot/#/builders/160/builds/4175
https://lab.llvm.org/buildbot/#/builders/180/builds/4173
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/3138

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/54/builds/1778

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 25
c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llc.exe -run-pass=codegenprepare -o - C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir | c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llc.exe' -run-pass=codegenprepare -o - 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\filecheck.exe' 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir'
# .---command stderr------------
# | C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: call{{.*}}fake.use(i32 %i)
# |               ^
# | <stdin>:23:9: note: 'next' match was here
# |  notail call void (...) @llvm.fake.use(i32 %i)
# |         ^
# | <stdin>:12:10: note: previous match ended here
# |  if.then: ; preds = %entry
# |          ^
# | <stdin>:13:1: note: non-matching line after previous match is here
# |  %call = tail call i32 (...) @f0()
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         18:  br label %if.end 
# |         19:   
# |         20:  if.end: ; preds = %if.else, %if.then 
# |         21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
# |         22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
# |         23:  notail call void (...) @llvm.fake.use(i32 %i) 
# | next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         24:  ret i32 %temp.0 
# |         25:  } 
# |         26:   
# |         27:  declare i32 @f0(...) local_unnamed_addr 
# |         28:   
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve-vls running on linaro-g3-01 while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/1769

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-vector2.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/llc -stop-after=finalize-isel -filetype=asm -o - /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll | /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/stage1/bin/llc -stop-after=finalize-isel -filetype=asm -o - /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll:14:10: error: CHECK: expected string not found in input
; CHECK: %0:vr256 = VMOV
         ^
<stdin>:1:1: note: scanning from here
--- |
^
<stdin>:89:2: note: possible intended match here
 %1:gpr32 = MOVi32imm 1
 ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: --- | 
check:14'0     X~~~~~ error: no match found
            2:  ; ModuleID = '/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll' 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  source_filename = "t5.cpp" 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4:  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:   
check:14'0     ~~
            6:  ; Function Attrs: optdebug 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
           84: machineFunctionInfo: {} 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~
           85: body: | 
check:14'0     ~~~~~~~~
           86:  bb.0.entry: 
check:14'0     ~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/155/builds/1901

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 25
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe -run-pass=codegenprepare -o - C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe' -run-pass=codegenprepare -o - 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe' 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir'
# .---command stderr------------
# | C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: call{{.*}}fake.use(i32 %i)
# |               ^
# | <stdin>:23:9: note: 'next' match was here
# |  notail call void (...) @llvm.fake.use(i32 %i)
# |         ^
# | <stdin>:12:10: note: previous match ended here
# |  if.then: ; preds = %entry
# |          ^
# | <stdin>:13:1: note: non-matching line after previous match is here
# |  %call = tail call i32 (...) @f0()
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\MIR\X86\fake-use-tailcall.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         18:  br label %if.end 
# |         19:   
# |         20:  if.end: ; preds = %if.else, %if.then 
# |         21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
# |         22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
# |         23:  notail call void (...) @llvm.fake.use(i32 %i) 
# | next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         24:  ret i32 %temp.0 
# |         25:  } 
# |         26:   
# |         27:  declare i32 @f0(...) local_unnamed_addr 
# |         28:   
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve-vla running on linaro-g3-03 while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/17/builds/2296

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-scheduler.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler 2>&1 -o - /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir | /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler -o - /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
/home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:10:10: error: CHECK: expected string not found in input
# CHECK: ********** MI Scheduling **********
         ^
<stdin>:1:1: note: scanning from here
error: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
^
<stdin>:1:79: note: possible intended match here
error: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
                                                                              ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: error: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64' 
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1                                                                                   ?                                                                                           possible intended match
            2:  - { id: 0, class: gr64, preferred-register: '' } 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ^ 
check:10'0     ~~~
            4:  
check:10'0     ~
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building llvm at step 7 "test-build-stage1-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/2715

Here is the relevant piece of the build log for the reference
Step 7 (test-build-stage1-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...
Step 13 (test-build-stage2-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-darwin running on doug-worker-3 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/23/builds/2504

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: DebugInfo/X86/fake-use.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 6: /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llc -O2 -filetype=obj -dwarf-linkage-names=Abstract < /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/DebugInfo/X86/fake-use.ll | /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llvm-dwarfdump --debug-info --debug-line -v - -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/DebugInfo/X86/Output/fake-use.ll.tmp
+ /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llc -O2 -filetype=obj -dwarf-linkage-names=Abstract
+ /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llvm-dwarfdump --debug-info --debug-line -v - -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/DebugInfo/X86/Output/fake-use.ll.tmp
RUN: at line 7: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9" /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/DebugInfo/X86/Output/fake-use.ll.tmp
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/DebugInfo/X86/Output/fake-use.ll.tmp
Traceback (most recent call last):
  File "/Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py", line 57, in <module>
    raise RuntimeError(f"Invalid location range list for 'b'")
RuntimeError: Invalid location range list for 'b'

--

********************


@tobias-stadler
Copy link
Contributor

tobias-stadler commented Aug 29, 2024

Sorry for only raising this now.
Would there be a good reason for not putting isFakeUse() into MachineInstr::isPosition() instead of sprinkling it over the codebase?
Putting into isPosition would make it a scheduling boundary, ignored by CSE, unsafe to move and therefore ignored by DCE and MachineSink.

@SLTozer
Copy link
Contributor Author

SLTozer commented Aug 29, 2024

Sorry for only raising this now. Is there a good reason for not putting isFakeUse() into MachineInstr::isPosition() instead of sprinkling it over the codebase? Putting into isPosition would make it a scheduling boundary, ignored by CSE, unsafe to move and therefore ignored by DCE and MachineSink.

It's not something I've thought about, but I'm happy to take a look at it and see if a refactoring patch would be worthwhile.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/2360

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...
Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

SLTozer added a commit that referenced this pull request Aug 29, 2024
One of the tests for the new fake use intrinsic are failing on darwin
buildbots due to relying on behaviour for their expected triple; this
commit adds explicit triples to the few remaining fake-use tests that
didn't have them.

Fixes commit 3d08ade (#86149).

Buildbot failures:
https://lab.llvm.org/buildbot/#/builders/23/builds/2505
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/1960

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py (1156 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteCompletion.py (1157 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteExitCode.py (1158 of 2012)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteFork.py (1159 of 2012)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteForkNonStop.py (1160 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteHostInfo.py (1161 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteExpeditedRegisters.py (1162 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteKill.py (1163 of 2012)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteModuleInfo.py (1164 of 2012)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemotePlatformFile.py (1165 of 2012)
FAIL: lldb-api :: tools/lldb-server/TestGdbRemoteLaunch.py (1166 of 2012)
******************** TEST 'lldb-api :: tools/lldb-server/TestGdbRemoteLaunch.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env OBJCOPY=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/llvm-objcopy.exe --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-server -p TestGdbRemoteLaunch.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 3d08ade7bd32f0296e0ca3a13640cc95fa89229a)
  clang revision 3d08ade7bd32f0296e0ca3a13640cc95fa89229a
  llvm revision 3d08ade7bd32f0296e0ca3a13640cc95fa89229a
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_QEnvironmentHexEncoded_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_QEnvironmentHexEncoded_llgs) (skip on windows) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_QEnvironment_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_QEnvironment_llgs) (skip on windows) 

PASS: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_failure_via_vRun_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_launch_failure_via_vRun_llgs)

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_via_A_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_launch_via_A_llgs) (skip on windows) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_via_vRun_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_launch_via_vRun_llgs) (skip on windows) 

FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_via_vRun_no_args_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_launch_via_vRun_no_args_llgs)

======================================================================

FAIL: test_launch_via_vRun_no_args_llgs (TestGdbRemoteLaunch.GdbRemoteLaunchTestCase.test_launch_via_vRun_no_args_llgs)

----------------------------------------------------------------------

Traceback (most recent call last):


@tobias-stadler
Copy link
Contributor

It's not something I've thought about, but I'm happy to take a look at it and see if a refactoring patch would be worthwhile.

Thanks! Just to clarify, I am not 100% sure that isPosition is the correct place to put this, but it seems like the best fit. If we find that isPosition doesn't work, we probably still want FAKE_USE to return false in MachineInstr::isSafeToMove() in some way or another though. isDebugInstr might also be worth considering, but I'm guessing it's not really a debug instruction?

@pogo59
Copy link
Collaborator

pogo59 commented Aug 29, 2024

isDebugInstr might also be worth considering, but I'm guessing it's not really a debug instruction?

FAKE_USE influences code generation so as a matter of principle it should not be thought of as a debug instruction. (Those are going away anyhow, but there's a dividing line there.)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 29, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/1561

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/bin/llc -run-pass=codegenprepare -o - /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@Prabhuk
Copy link
Contributor

Prabhuk commented Aug 29, 2024

We are seeing a test failure in our builders which I think is related to this patch:

https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-base-mac-x64/b8738251281152890817/overview

FAIL: LLVM :: DebugInfo/X86/fake-use.ll (28733 of 54710)
******************** TEST 'LLVM :: DebugInfo/X86/fake-use.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 6: /Volumes/Work/s/w/ir/x/w/llvm_build/bin/llc -O2 -filetype=obj -dwarf-linkage-names=Abstract < /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/llvm/test/DebugInfo/X86/fake-use.ll | /Volumes/Work/s/w/ir/x/w/llvm_build/bin/llvm-dwarfdump --debug-info --debug-line -v - -o /Volumes/Work/s/w/ir/x/w/llvm_build/test/DebugInfo/X86/Output/fake-use.ll.tmp
+ /Volumes/Work/s/w/ir/x/w/llvm_build/bin/llc -O2 -filetype=obj -dwarf-linkage-names=Abstract
+ /Volumes/Work/s/w/ir/x/w/llvm_build/bin/llvm-dwarfdump --debug-info --debug-line -v - -o /Volumes/Work/s/w/ir/x/w/llvm_build/test/DebugInfo/X86/Output/fake-use.ll.tmp
RUN: at line 7: "/Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9" /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py /Volumes/Work/s/w/ir/x/w/llvm_build/test/DebugInfo/X86/Output/fake-use.ll.tmp
+ /Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py /Volumes/Work/s/w/ir/x/w/llvm_build/test/DebugInfo/X86/Output/fake-use.ll.tmp
Traceback (most recent call last):
  File "/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/llvm/test/DebugInfo/X86/../Inputs/check-fake-use.py", line 57, in <module>
    raise RuntimeError(f"Invalid location range list for 'b'")
RuntimeError: Invalid location range list for 'b'

I am investigating further to confirm.

@SLTozer
Copy link
Contributor Author

SLTozer commented Aug 29, 2024

I am investigating further to confirm.

Some of the tests added in this patch didn't have an explicit triple, which was necessary for the test to pass for some targets - I've already committed updates to add those triples, by the looks of it the test has started passing as of that commit:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-base-mac-x64/b8738234501894039297/overview

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-global-isel running on linaro-clang-aarch64-global-isel while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/125/builds/1697

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-scheduler.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler 2>&1 -o - /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir | /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler -o - /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
/home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:10:10: error: CHECK: expected string not found in input
# CHECK: ********** MI Scheduling **********
         ^
<stdin>:1:1: note: scanning from here
error: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
^
<stdin>:1:83: note: possible intended match here
error: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
                                                                                  ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: error: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64' 
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1                                                                                       ?                                                                                           possible intended match
            2:  - { id: 0, class: gr64, preferred-register: '' } 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ^ 
check:10'0     ~~~
            4:  
check:10'0     ~
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder clang-armv7-global-isel running on linaro-clang-armv7-global-isel while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/1330

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-vector2.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -stop-after=finalize-isel -filetype=asm -o - /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -stop-after=finalize-isel -filetype=asm -o - /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
'btver2' is not a recognized processor for this target (ignoring processor)
/home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll:14:10: error: CHECK: expected string not found in input
; CHECK: %0:vr256 = VMOV
         ^
<stdin>:1:1: note: scanning from here
--- |
^
<stdin>:81:2: note: possible intended match here
 %0:gpr = MOVi 0, 14 /* CC::al */, $noreg, $noreg
 ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: --- | 
check:14'0     X~~~~~ error: no match found
            2:  ; ModuleID = '/home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/fake-use-vector2.ll' 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  source_filename = "t5.cpp" 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4:  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:   
check:14'0     ~~
            6:  ; Function Attrs: optdebug 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
           76: constants: [] 
check:14'0     ~~~~~~~~~~~~~~
           77: machineFunctionInfo: 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/900

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-scheduler.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler 2>&1 -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:10:10: error: CHECK: expected string not found in input
# CHECK: ********** MI Scheduling **********
         ^
<stdin>:1:1: note: scanning from here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
^
<stdin>:1:80: note: possible intended match here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
                                                                               ^

Input file: <stdin>
Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: error: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64' 
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1                                                                                    ?                                                                                           possible intended match
            2:  - { id: 0, class: gr64, preferred-register: '' } 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ^ 
check:10'0     ~~~
            4:  
check:10'0     ~
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/1001

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/42/86' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-3744-42-86.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=86 GTEST_SHARD_INDEX=42 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-lnt running on systemz-1 while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/136/builds/770

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-zero-length.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/bin/llc < /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/llvm/test/CodeGen/X86/fake-use-zero-length.ll -stop-after=finalize-isel | /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/llvm/test/CodeGen/X86/fake-use-zero-length.ll --implicit-check-not=FAKE_USE
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/llvm/test/CodeGen/X86/fake-use-zero-length.ll --implicit-check-not=FAKE_USE
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/bin/llc -stop-after=finalize-isel
/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/llvm/test/CodeGen/X86/fake-use-zero-length.ll:14:10: error: CHECK: expected string not found in input
; CHECK: %[[IN_VREG:[a-zA-Z0-9]+]]:gr32 = COPY $[[IN_REG]]
         ^
<stdin>:82:15: note: scanning from here
 liveins: $r2l
              ^
<stdin>:82:15: note: with "IN_REG" equal to "r2l"
 liveins: $r2l
              ^
<stdin>:84:2: note: possible intended match here
 %0:gr32bit = COPY $r2l
 ^

Input file: <stdin>
Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/llvm/llvm/test/CodeGen/X86/fake-use-zero-length.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           77: debugValueSubstitutions: [] 
           78: constants: [] 
           79: machineFunctionInfo: {} 
           80: body: | 
           81:  bb.0.entry: 
           82:  liveins: $r2l 
check:14'0                   X error: no match found
check:14'1                     with "IN_REG" equal to "r2l"
           83:   
check:14'0     ~~
           84:  %0:gr32bit = COPY $r2l 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~
check:14'2      ?                       possible intended match
           85:  CallBRASL @bar, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           86:  $r2l = COPY %0 
check:14'0     ~~~~~~~~~~~~~~~~
           87:  CallBRASL @baz, $r2l, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building llvm at step 3 "clean-build-dir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/820

Here is the relevant piece of the build log for the reference
Step 3 (clean-build-dir) failure: Delete failed. (failure) (timed out)
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/MIR/X86/fake-use-tailcall.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 25: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/llc -run-pass=codegenprepare -o - /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir | /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/llc -run-pass=codegenprepare -o - /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir:29:15: error: CHECK-NEXT: is not on the line after the previous match
# CHECK-NEXT: call{{.*}}fake.use(i32 %i)
              ^
<stdin>:23:9: note: 'next' match was here
 notail call void (...) @llvm.fake.use(i32 %i)
        ^
<stdin>:12:10: note: previous match ended here
 if.then: ; preds = %entry
         ^
<stdin>:13:1: note: non-matching line after previous match is here
 %call = tail call i32 (...) @f0()
^

Input file: <stdin>
Check file: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/MIR/X86/fake-use-tailcall.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
        18:  br label %if.end 
        19:   
        20:  if.end: ; preds = %if.else, %if.then 
        21:  %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ] 
        22:  notail call void (...) @llvm.fake.use(i32 %temp.0) 
        23:  notail call void (...) @llvm.fake.use(i32 %i) 
next:29             !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        24:  ret i32 %temp.0 
        25:  } 
        26:   
        27:  declare i32 @f0(...) local_unnamed_addr 
        28:   
         .
         .
         .
>>>>>>

--

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 21, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-multistage running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/98/builds/394

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-scheduler.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler 2>&1 -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:10:10: error: CHECK: expected string not found in input
# CHECK: ********** MI Scheduling **********
         ^
<stdin>:1:1: note: scanning from here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
^
<stdin>:1:91: note: possible intended match here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
                                                                                          ^

Input file: <stdin>
Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64' 
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1                                                                                               ?                                                                                           possible intended match
            2:  - { id: 0, class: gr64, preferred-register: '' } 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ^ 
check:10'0     ~~~
            4:  
check:10'0     ~
>>>>>>

--

********************

Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/fake-use-scheduler.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler 2>&1 -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -run-pass machine-scheduler -debug-only=machine-scheduler -o - /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:10:10: error: CHECK: expected string not found in input
# CHECK: ********** MI Scheduling **********
         ^
<stdin>:1:1: note: scanning from here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
^
<stdin>:1:91: note: possible intended match here
error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64'
                                                                                          ^

Input file: <stdin>
Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: error: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/fake-use-scheduler.mir:69:21: use of undefined register class or register bank 'gr64' 
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1                                                                                               ?                                                                                           possible intended match
            2:  - { id: 0, class: gr64, preferred-register: '' } 
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ^ 
check:10'0     ~~~
            4:  
check:10'0     ~
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 25, 2024

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/349

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/M68k/pipeline.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mtriple=m68k -debug-pass=Structure < /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/M68k/pipeline.ll -o /dev/null 2>&1 | grep -v "Verify generated machine code" | /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/M68k/pipeline.ll
+ /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mtriple=m68k -debug-pass=Structure -o /dev/null
+ grep -v 'Verify generated machine code'
+ /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/M68k/pipeline.ll
/srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/M68k/pipeline.ll:137:15: error: CHECK-NEXT: is not on the line after the previous match
; CHECK-NEXT: StackMap Liveness Analysis
              ^
<stdin>:150:2: note: 'next' match was here
 StackMap Liveness Analysis
 ^
<stdin>:148:31: note: previous match ended here
 Contiguously Lay Out Funclets
                              ^
<stdin>:149:1: note: non-matching line after previous match is here
 Remove Loads Into Fake Uses
^

Input file: <stdin>
Check file: /srv/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/M68k/pipeline.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          .
          .
          .
        145:  Insert XRay ops 
        146:  Implement the 'patchable-function' attribute 
        147:  M68k MOVEM collapser pass 
        148:  Contiguously Lay Out Funclets 
        149:  Remove Loads Into Fake Uses 
        150:  StackMap Liveness Analysis 
next:137      !~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
        151:  Live DEBUG_VALUE analysis 
        152:  Machine Sanitizer Binary Metadata 
        153:  Lazy Machine Block Frequency Analysis 
        154:  Machine Optimization Remark Emitter 
        155:  Stack Frame Layout Analysis 
        156:  M68k Assembly Printer 
        157:  Free MachineFunction 
>>>>>>

--

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.