Skip to content

Conversation

@XChy
Copy link
Member

@XChy XChy commented Sep 3, 2025

This patch addresses #155216 (comment).
This patch adds a helper function to put the inverse cast on constants, with cast flags preserved(optional).
Follow-up patches will add trunc/ext handling on VectorCombine and flags preservation on InstCombine.

@XChy XChy requested review from RKSimon, dtcxzyw and nikic September 3, 2025 06:53
@github-actions
Copy link

github-actions bot commented Sep 3, 2025

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

if (match(Cast, m_OneUse(m_ZExt(m_Value(X))))) {
if (Constant *TruncC = IC.getLosslessUnsignedTrunc(C, SrcTy)) {
if (Constant *TruncC =
getLosslessInvCast(C, SrcTy, Instruction::ZExt, DL)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also remove the old helper functions, which are presumably unused now?

TBH I find the new API super confusing. This is doing a truncate, but it's phrased in terms of a ZExt.

Copy link
Member Author

@XChy XChy Sep 3, 2025

Choose a reason for hiding this comment

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

Also remove the old helper functions, which are presumably unused now?

Oh sure. I missed it.

TBH I find the new API super confusing. This is doing a truncate, but it's phrased in terms of a ZExt.

It's doing the inverse cast of ZExt, to find a constant InvC, s.t. ZExt(InvC) == C. Or we still extract the ZExt/SExt part and name it getLosslessTrunc?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its messy, but we could keep the getLosslessUnsignedTrunc/getLosslessSignedTrunc function names and change them to wrappers for getLosslessInvCast?

bool NSW = false;
};

/// Try to cast C to InvC losslessly, satisfying CastOp(InvC) == C.
Copy link
Member

Choose a reason for hiding this comment

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

CastOp(InvC) == C is imprecise (e.g., bitcast <2 x i16> <i16 0, i16 poison> to i32 is refined to 0).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. What about CastOp(InvC) == C or CastOp(InvC) is one of the possible values of C if C is undefined

@llvmbot llvmbot added vectorizers llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms llvm:vectorcombine labels Sep 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2025

@llvm/pr-subscribers-llvm-analysis

@llvm/pr-subscribers-llvm-transforms

Author: Hongyu Chen (XChy)

Changes

This patch addresses #155216 (comment).
This patch adds a helper function to put the inverse cast on constants, with cast flags preserved(optional).
Follow-up patches will add trunc/ext handling on VectorCombine and flags preservation on InstCombine.


Full diff: https://github.com/llvm/llvm-project/pull/156597.diff

11 Files Affected:

  • (modified) llvm/include/llvm/Analysis/ConstantFolding.h (+22-1)
  • (modified) llvm/lib/Analysis/ConstantFolding.cpp (+51)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (+3-2)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp (+2-2)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+1-1)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineInternal.h (-17)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (+3-2)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp (+1-1)
  • (modified) llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (+1-1)
  • (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Vectorize/VectorCombine.cpp (+1-46)
diff --git a/llvm/include/llvm/Analysis/ConstantFolding.h b/llvm/include/llvm/Analysis/ConstantFolding.h
index dcbac8a301025..5f91f9747bb97 100644
--- a/llvm/include/llvm/Analysis/ConstantFolding.h
+++ b/llvm/include/llvm/Analysis/ConstantFolding.h
@@ -226,6 +226,27 @@ LLVM_ABI bool isMathLibCallNoop(const CallBase *Call,
 
 LLVM_ABI Constant *ReadByteArrayFromGlobal(const GlobalVariable *GV,
                                            uint64_t Offset);
-}
+
+struct PreservedCastFlags {
+  bool NNeg = false;
+  bool NUW = false;
+  bool NSW = false;
+};
+
+/// Try to cast C to InvC losslessly, satisfying CastOp(InvC) equals C, or
+/// CastOp(InvC) is a refined value of undefined C. Will try best to
+/// preserve the flags.
+LLVM_ABI Constant *getLosslessInvCast(Constant *C, Type *InvCastTo,
+                                      unsigned CastOp, const DataLayout &DL,
+                                      PreservedCastFlags *Flags = nullptr);
+
+LLVM_ABI Constant *
+getLosslessUnsignedTrunc(Constant *C, Type *DestTy, const DataLayout &DL,
+                         PreservedCastFlags *Flags = nullptr);
+
+LLVM_ABI Constant *getLosslessSignedTrunc(Constant *C, Type *DestTy,
+                                          const DataLayout &DL,
+                                          PreservedCastFlags *Flags = nullptr);
+} // namespace llvm
 
 #endif
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 2148431c1acce..40e176c2ab5ce 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -4608,4 +4608,55 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
   return false;
 }
 
+Constant *llvm::getLosslessInvCast(Constant *C, Type *InvCastTo,
+                                   unsigned CastOp, const DataLayout &DL,
+                                   PreservedCastFlags *Flags) {
+  switch (CastOp) {
+  case Instruction::BitCast:
+    // Bitcast is always lossless.
+    return ConstantFoldCastOperand(Instruction::BitCast, C, InvCastTo, DL);
+  case Instruction::Trunc: {
+    auto *ZExtC = ConstantFoldCastOperand(Instruction::ZExt, C, InvCastTo, DL);
+    if (Flags) {
+      // Truncation back on ZExt value is always NUW.
+      Flags->NUW = true;
+      // Test positivity of C.
+      auto *SExtC =
+          ConstantFoldCastOperand(Instruction::SExt, C, InvCastTo, DL);
+      Flags->NSW = ZExtC == SExtC;
+    }
+    return ZExtC;
+  }
+  case Instruction::SExt:
+  case Instruction::ZExt: {
+    auto *InvC = ConstantExpr::getTrunc(C, InvCastTo);
+    auto *CastInvC = ConstantFoldCastOperand(CastOp, InvC, C->getType(), DL);
+    // Must satisfy CastOp(InvC) == C.
+    if (!CastInvC || CastInvC != C)
+      return nullptr;
+    if (Flags && CastOp == Instruction::ZExt) {
+      auto *SExtInvC =
+          ConstantFoldCastOperand(Instruction::SExt, InvC, C->getType(), DL);
+      // Test positivity of InvC.
+      Flags->NNeg = CastInvC == SExtInvC;
+    }
+    return InvC;
+  }
+  default:
+    return nullptr;
+  }
+}
+
+Constant *llvm::getLosslessUnsignedTrunc(Constant *C, Type *DestTy,
+                                         const DataLayout &DL,
+                                         PreservedCastFlags *Flags) {
+  return getLosslessInvCast(C, DestTy, Instruction::ZExt, DL, Flags);
+}
+
+Constant *llvm::getLosslessSignedTrunc(Constant *C, Type *DestTy,
+                                       const DataLayout &DL,
+                                       PreservedCastFlags *Flags) {
+  return getLosslessInvCast(C, DestTy, Instruction::SExt, DL, Flags);
+}
+
 void TargetFolder::anchor() {}
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index a13d3ceb61320..8b9df62d7c652 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1799,8 +1799,9 @@ static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
   // type may provide more information to later folds, and the smaller logic
   // instruction may be cheaper (particularly in the case of vectors).
   Value *X;
+  auto &DL = IC.getDataLayout();
   if (match(Cast, m_OneUse(m_ZExt(m_Value(X))))) {
-    if (Constant *TruncC = IC.getLosslessUnsignedTrunc(C, SrcTy)) {
+    if (Constant *TruncC = getLosslessUnsignedTrunc(C, SrcTy, DL)) {
       // LogicOpc (zext X), C --> zext (LogicOpc X, C)
       Value *NewOp = IC.Builder.CreateBinOp(LogicOpc, X, TruncC);
       return new ZExtInst(NewOp, DestTy);
@@ -1808,7 +1809,7 @@ static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
   }
 
   if (match(Cast, m_OneUse(m_SExtLike(m_Value(X))))) {
-    if (Constant *TruncC = IC.getLosslessSignedTrunc(C, SrcTy)) {
+    if (Constant *TruncC = getLosslessSignedTrunc(C, SrcTy, DL)) {
       // LogicOpc (sext X), C --> sext (LogicOpc X, C)
       Value *NewOp = IC.Builder.CreateBinOp(LogicOpc, X, TruncC);
       return new SExtInst(NewOp, DestTy);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 42b65dde67255..33b66aeaffe60 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1956,7 +1956,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     Constant *C;
     if (match(I0, m_ZExt(m_Value(X))) && match(I1, m_Constant(C)) &&
         I0->hasOneUse()) {
-      if (Constant *NarrowC = getLosslessUnsignedTrunc(C, X->getType())) {
+      if (Constant *NarrowC = getLosslessUnsignedTrunc(C, X->getType(), DL)) {
         Value *NarrowMaxMin = Builder.CreateBinaryIntrinsic(IID, X, NarrowC);
         return CastInst::Create(Instruction::ZExt, NarrowMaxMin, II->getType());
       }
@@ -2006,7 +2006,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     Constant *C;
     if (match(I0, m_SExt(m_Value(X))) && match(I1, m_Constant(C)) &&
         I0->hasOneUse()) {
-      if (Constant *NarrowC = getLosslessSignedTrunc(C, X->getType())) {
+      if (Constant *NarrowC = getLosslessSignedTrunc(C, X->getType(), DL)) {
         Value *NarrowMaxMin = Builder.CreateBinaryIntrinsic(IID, X, NarrowC);
         return CastInst::Create(Instruction::SExt, NarrowMaxMin, II->getType());
       }
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 90feddf6dcfe1..861630680752f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -6375,7 +6375,7 @@ Instruction *InstCombinerImpl::foldICmpWithZextOrSext(ICmpInst &ICmp) {
 
   // If a lossless truncate is possible...
   Type *SrcTy = CastOp0->getSrcTy();
-  Constant *Res = getLosslessTrunc(C, SrcTy, CastOp0->getOpcode());
+  Constant *Res = getLosslessInvCast(C, SrcTy, CastOp0->getOpcode(), DL);
   if (Res) {
     if (ICmp.isEquality())
       return new ICmpInst(ICmp.getPredicate(), X, Res);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 2340028ce93dc..d3d23130b6fc4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -222,23 +222,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   bool fmulByZeroIsZero(Value *MulVal, FastMathFlags FMF,
                         const Instruction *CtxI) const;
 
-  Constant *getLosslessTrunc(Constant *C, Type *TruncTy, unsigned ExtOp) {
-    Constant *TruncC = ConstantExpr::getTrunc(C, TruncTy);
-    Constant *ExtTruncC =
-        ConstantFoldCastOperand(ExtOp, TruncC, C->getType(), DL);
-    if (ExtTruncC && ExtTruncC == C)
-      return TruncC;
-    return nullptr;
-  }
-
-  Constant *getLosslessUnsignedTrunc(Constant *C, Type *TruncTy) {
-    return getLosslessTrunc(C, TruncTy, Instruction::ZExt);
-  }
-
-  Constant *getLosslessSignedTrunc(Constant *C, Type *TruncTy) {
-    return getLosslessTrunc(C, TruncTy, Instruction::SExt);
-  }
-
   std::optional<std::pair<Intrinsic::ID, SmallVector<Value *, 3>>>
   convertOrOfShiftsToFunnelShift(Instruction &Or);
 
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index d7310b1c741c0..a9aacc707cc20 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1642,10 +1642,11 @@ static Instruction *narrowUDivURem(BinaryOperator &I,
   }
 
   Constant *C;
+  auto &DL = IC.getDataLayout();
   if (isa<Instruction>(N) && match(N, m_OneUse(m_ZExt(m_Value(X)))) &&
       match(D, m_Constant(C))) {
     // If the constant is the same in the smaller type, use the narrow version.
-    Constant *TruncC = IC.getLosslessUnsignedTrunc(C, X->getType());
+    Constant *TruncC = getLosslessUnsignedTrunc(C, X->getType(), DL);
     if (!TruncC)
       return nullptr;
 
@@ -1656,7 +1657,7 @@ static Instruction *narrowUDivURem(BinaryOperator &I,
   if (isa<Instruction>(D) && match(D, m_OneUse(m_ZExt(m_Value(X)))) &&
       match(N, m_Constant(C))) {
     // If the constant is the same in the smaller type, use the narrow version.
-    Constant *TruncC = IC.getLosslessUnsignedTrunc(C, X->getType());
+    Constant *TruncC = getLosslessUnsignedTrunc(C, X->getType(), DL);
     if (!TruncC)
       return nullptr;
 
diff --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index 6477141ab095f..ed9a0be6981fa 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -841,7 +841,7 @@ Instruction *InstCombinerImpl::foldPHIArgZextsIntoPHI(PHINode &Phi) {
       NumZexts++;
     } else if (auto *C = dyn_cast<Constant>(V)) {
       // Make sure that constants can fit in the new type.
-      Constant *Trunc = getLosslessUnsignedTrunc(C, NarrowType);
+      Constant *Trunc = getLosslessUnsignedTrunc(C, NarrowType, DL);
       if (!Trunc)
         return nullptr;
       NewIncoming.push_back(Trunc);
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index ba8b4c47e8f88..9467463d39c0e 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2375,7 +2375,7 @@ Instruction *InstCombinerImpl::foldSelectExtConst(SelectInst &Sel) {
   // If the constant is the same after truncation to the smaller type and
   // extension to the original type, we can narrow the select.
   Type *SelType = Sel.getType();
-  Constant *TruncC = getLosslessTrunc(C, SmallType, ExtOpcode);
+  Constant *TruncC = getLosslessInvCast(C, SmallType, ExtOpcode, DL);
   if (TruncC && ExtInst->hasOneUse()) {
     Value *TruncCVal = cast<Value>(TruncC);
     if (ExtInst == Sel.getFalseValue())
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 1a9b54bc009bc..4960a50bbede8 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2568,7 +2568,7 @@ Instruction *InstCombinerImpl::narrowMathIfNoOverflow(BinaryOperator &BO) {
     Constant *WideC;
     if (!Op0->hasOneUse() || !match(Op1, m_Constant(WideC)))
       return nullptr;
-    Constant *NarrowC = getLosslessTrunc(WideC, X->getType(), CastOpc);
+    Constant *NarrowC = getLosslessInvCast(WideC, X->getType(), CastOpc, DL);
     if (!NarrowC)
       return nullptr;
     Y = NarrowC;
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 6e46547b15b2b..93b3a0eeb0305 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -938,51 +938,6 @@ bool VectorCombine::foldBitOpOfCastops(Instruction &I) {
   return true;
 }
 
-struct PreservedCastFlags {
-  bool NNeg = false;
-  bool NUW = false;
-  bool NSW = false;
-};
-
-// Try to cast C to InvC losslessly, satisfying CastOp(InvC) == C.
-// Will try best to preserve the flags.
-static Constant *getLosslessInvCast(Constant *C, Type *InvCastTo,
-                                    Instruction::CastOps CastOp,
-                                    const DataLayout &DL,
-                                    PreservedCastFlags &Flags) {
-  switch (CastOp) {
-  case Instruction::BitCast:
-    // Bitcast is always lossless.
-    return ConstantFoldCastOperand(Instruction::BitCast, C, InvCastTo, DL);
-  case Instruction::Trunc: {
-    auto *ZExtC = ConstantFoldCastOperand(Instruction::ZExt, C, InvCastTo, DL);
-    auto *SExtC = ConstantFoldCastOperand(Instruction::SExt, C, InvCastTo, DL);
-    // Truncation back on ZExt value is always NUW.
-    Flags.NUW = true;
-    // Test positivity of C.
-    Flags.NSW = ZExtC == SExtC;
-    return ZExtC;
-  }
-  case Instruction::SExt:
-  case Instruction::ZExt: {
-    auto *InvC = ConstantExpr::getTrunc(C, InvCastTo);
-    auto *CastInvC = ConstantFoldCastOperand(CastOp, InvC, C->getType(), DL);
-    // Must satisfy CastOp(InvC) == C.
-    if (!CastInvC || CastInvC != C)
-      return nullptr;
-    if (CastOp == Instruction::ZExt) {
-      auto *SExtInvC =
-          ConstantFoldCastOperand(Instruction::SExt, InvC, C->getType(), DL);
-      // Test positivity of InvC.
-      Flags.NNeg = CastInvC == SExtInvC;
-    }
-    return InvC;
-  }
-  default:
-    return nullptr;
-  }
-}
-
 /// Match:
 // bitop(castop(x), C) ->
 // bitop(castop(x), castop(InvC)) ->
@@ -1025,7 +980,7 @@ bool VectorCombine::foldBitOpOfCastConstant(Instruction &I) {
 
   // Find the constant InvC, such that castop(InvC) equals to C.
   PreservedCastFlags RHSFlags;
-  Constant *InvC = getLosslessInvCast(C, SrcVecTy, CastOpcode, *DL, RHSFlags);
+  Constant *InvC = getLosslessInvCast(C, SrcVecTy, CastOpcode, *DL, &RHSFlags);
   if (!InvC)
     return false;
 

@XChy
Copy link
Member Author

XChy commented Sep 8, 2025

Gently ping.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM

@XChy XChy enabled auto-merge (squash) September 8, 2025 12:53
@XChy XChy merged commit 75b0c89 into llvm:main Sep 8, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 8, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building llvm at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
[693/1422] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/PointerEmbeddedIntTest.cpp.o
[694/1422] Building CXX object tools/clang/unittests/Sema/CMakeFiles/SemaTests.dir/HeuristicResolverTest.cpp.o
[695/1422] Linking CXX executable bin/yaml2obj
[695/1422] Running lld test suite
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/wasm-ld
-- Testing: 3138 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: lld :: MachO/read-workers.s (2810 of 3138)
******************** TEST 'lld :: MachO/read-workers.s' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 2
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/read-workers.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o
# executed command: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/read-workers.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o
# RUN: at line 5
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=0 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=0 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# RUN: at line 6
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=1 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=1 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# RUN: at line 7
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=2 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=2 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  lld :: MachO/read-workers.s


Testing Time: 27.62s

Total Discovered Tests: 3138
  Unsupported:  569 (18.13%)
  Passed     : 2568 (81.84%)
  Failed     :    1 (0.03%)
[850/1422] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/TypeTraitsTest.cpp.o
FAILED: tools/lld/test/CMakeFiles/check-lld /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/CMakeFiles/check-lld 
cd /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test && /usr/bin/python3.10 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/./bin/llvm-lit -sv /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test
Step 7 (check) failure: check (failure)
...
[693/1422] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/PointerEmbeddedIntTest.cpp.o
[694/1422] Building CXX object tools/clang/unittests/Sema/CMakeFiles/SemaTests.dir/HeuristicResolverTest.cpp.o
[695/1422] Linking CXX executable bin/yaml2obj
[695/1422] Running lld test suite
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:527: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/wasm-ld
-- Testing: 3138 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: lld :: MachO/read-workers.s (2810 of 3138)
******************** TEST 'lld :: MachO/read-workers.s' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 2
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/read-workers.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o
# executed command: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/read-workers.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o
# RUN: at line 5
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=0 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=0 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# RUN: at line 6
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=1 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=1 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# RUN: at line 7
ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=2 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# executed command: ld64.lld -arch x86_64 -platform_version macos 11.0 11.0 -syslibroot /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -lSystem -fatal_warnings --read-workers=2 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/MachO/Output/read-workers.s.tmp.o -o /dev/null
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  lld :: MachO/read-workers.s


Testing Time: 27.62s

Total Discovered Tests: 3138
  Unsupported:  569 (18.13%)
  Passed     : 2568 (81.84%)
  Failed     :    1 (0.03%)
[850/1422] Building CXX object unittests/CodeGen/CMakeFiles/CodeGenTests.dir/TypeTraitsTest.cpp.o
FAILED: tools/lld/test/CMakeFiles/check-lld /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test/CMakeFiles/check-lld 
cd /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test && /usr/bin/python3.10 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/./bin/llvm-lit -sv /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v2g_w8yy/tools/lld/test

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

Labels

llvm:analysis Includes value tracking, cost tables and constant folding llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms llvm:vectorcombine vectorizers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants