Skip to content

[GlobalISel] Implement G_UADDO/G_UADDE/G_SADDO/G_SADDE for computeKnownBits#165497

Merged
ningxinr merged 7 commits into
llvm:mainfrom
ningxinr:issue-150515-carry
Dec 30, 2025
Merged

[GlobalISel] Implement G_UADDO/G_UADDE/G_SADDO/G_SADDE for computeKnownBits#165497
ningxinr merged 7 commits into
llvm:mainfrom
ningxinr:issue-150515-carry

Conversation

@ningxinr

@ningxinr ningxinr commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

Addressing the carry out cases Matt mentioned in #159202.

Note: G_[US]SUB[OE] will be implemented in a different PR.

@ningxinr ningxinr requested review from RKSimon and arsenm October 29, 2025 01:49
@ningxinr ningxinr self-assigned this Oct 29, 2025

@ningxinr ningxinr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi Simon and Matt, would either of you help me with the questions regarding the SADD[OE]? Thanks!

Comment on lines +12 to +13
; CHECK-NEXT: %3:_ KnownBits:0001101? SignBits:3
; CHECK-NEXT: %4:_ KnownBits:? SignBits:1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems the calculation with the carry bit is not propagated to the later computation. I will take a look.

Comment on lines +27 to +28
; CHECK-NEXT: %3:_ KnownBits:0001101? SignBits:3
; CHECK-NEXT: %4:_ KnownBits:? SignBits:1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ditto

Comment on lines +42 to +43
; CHECK-NEXT: %3:_ KnownBits:100000?? SignBits:1
; CHECK-NEXT: %4:_ KnownBits:? SignBits:1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this expected for SADD[OE]? I thought in this case we should have the carry out bit set to one instead of overflowing. Something looks like the following:

Suggested change
; CHECK-NEXT: %3:_ KnownBits:100000?? SignBits:1
; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
; CHECK-NEXT: %3:_ KnownBits:00000001 SignBits:1
; CHECK-NEXT: %4:_ KnownBits:1 SignBits:1

Also, the same behavior can be reproduced for SADDO_CARRY in SelectionDAG. Plus, I couldn't seem to figure out how KnownBits::computeForAddCarry differentiate add for signed int or unsigned int. Am I missing something here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gentle ping: Any comments regarding my questions above and this change in general, Matt(@arsenm) and Evgenii(@e-kud)? Thank you thank you

@RKSimon RKSimon requested a review from e-kud October 29, 2025 08:31
Comment thread llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp Outdated
@RKSimon RKSimon self-requested a review October 30, 2025 17:44
@RKSimon

RKSimon commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

Patch seems fine to me - time to leave draft and make it "Ready for Review"?

@ningxinr

Copy link
Copy Markdown
Contributor Author

Patch seems fine to me - time to leave draft and make it "Ready for Review"?

Thank you, Simon! Let me add the remaining tests and I will make it "Ready for Review" afterwards.

@RKSimon

RKSimon commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

@ningxinr any luck with the additional test coverage?

@ningxinr

Copy link
Copy Markdown
Contributor Author

@ningxinr any luck with the additional test coverage?

Thank you for following up on this, Simon. Sorry I got distracted lately. I will try to get back to this late this week/earlier next week.

@RKSimon RKSimon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

waiting on additional test coverage

@llvmbot

llvmbot commented Dec 23, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-llvm-globalisel

@llvm/pr-subscribers-backend-aarch64

Author: Yatao Wang (ningxinr)

Changes

This is a draft PR addressing the carry out cases Matt mentioned in #159202.

TODO: Add more tests once I can confirm that this is on the right track. G_[US]SUB[OE] will be implemented in a different PR.


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

7 Files Affected:

  • (modified) llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp (+31-1)
  • (added) llvm/test/CodeGen/AArch64/GlobalISel/knownbits-sadde.mir (+275)
  • (added) llvm/test/CodeGen/AArch64/GlobalISel/knownbits-saddo.mir (+163)
  • (added) llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uadde.mir (+275)
  • (added) llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uaddo.mir (+163)
  • (modified) llvm/test/CodeGen/X86/GlobalISel/legalize-trailing-zeros-undef.mir (+1-5)
  • (modified) llvm/test/CodeGen/X86/GlobalISel/legalize-trailing-zeros.mir (+1-5)
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp b/llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
index d6f23b62519fe..1a99fad02293c 100644
--- a/llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
@@ -615,7 +615,37 @@ void GISelValueTracking::computeKnownBitsImpl(Register R, KnownBits &Known,
   case TargetOpcode::G_UADDO:
   case TargetOpcode::G_UADDE:
   case TargetOpcode::G_SADDO:
-  case TargetOpcode::G_SADDE:
+  case TargetOpcode::G_SADDE: {
+    if (MI.getOperand(1).getReg() == R) {
+      // If we know the result of a compare has the top bits zero, use this
+      // info.
+      if (TL.getBooleanContents(DstTy.isVector(), false) ==
+              TargetLowering::ZeroOrOneBooleanContent &&
+          BitWidth > 1)
+        Known.Zero.setBitsFrom(1);
+      break;
+    }
+
+    assert(MI.getOperand(0).getReg() == R &&
+           "We only compute knownbits for the sum here.");
+    // With [US]ADDE, a carry bit may be added in.
+    KnownBits Carry(1);
+    if (Opcode == TargetOpcode::G_UADDE || Opcode == TargetOpcode::G_SADDE) {
+      computeKnownBitsImpl(MI.getOperand(4).getReg(), Carry, DemandedElts,
+                           Depth + 1);
+      // Carry has bit width 1
+      Carry = Carry.trunc(1);
+    } else {
+      Carry.setAllZero();
+    }
+
+    computeKnownBitsImpl(MI.getOperand(2).getReg(), Known, DemandedElts,
+                         Depth + 1);
+    computeKnownBitsImpl(MI.getOperand(3).getReg(), Known2, DemandedElts,
+                         Depth + 1);
+    Known = KnownBits::computeForAddCarry(Known, Known2, Carry);
+    break;
+  }
   case TargetOpcode::G_USUBO:
   case TargetOpcode::G_USUBE:
   case TargetOpcode::G_SSUBO:
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-sadde.mir b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-sadde.mir
new file mode 100644
index 0000000000000..90c3395264de5
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-sadde.mir
@@ -0,0 +1,275 @@
+# NOTE: Assertions have been autogenerated by utils/update_givaluetracking_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -mtriple=aarch64 -passes="print<gisel-value-tracking>" -filetype=null %s 2>&1 | FileCheck %s
+
+---
+name:            CstCarryInZeroOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInZeroOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:00011000 SignBits:3
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:00011010 SignBits:3
+  ; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 24
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(s8), %4:_(s1) = G_SADDE %0, %1, %2
+...
+---
+name:            CstCarryInOneOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInOneOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:00011000 SignBits:3
+  ; CHECK-NEXT: %2:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:00011011 SignBits:3
+  ; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 24
+    %2:_(s1) = G_CONSTANT i1 1
+    %3:_(s8), %4:_(s1) = G_SADDE %0, %1, %2
+...
+---
+name:            CstCarryInZeroOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInZeroOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:01111111 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:10000001 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 127
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(s8), %4:_(s1) = G_SADDE %0, %1, %2
+...
+---
+name:            CstCarryInOneOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInOneOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:01111111 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:10000010 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 127
+    %2:_(s1) = G_CONSTANT i1 1
+    %3:_(s8), %4:_(s1) = G_SADDE %0, %1, %2
+...
+---
+name:            ScalarVar
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @ScalarVar
+  ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(s8) = COPY $b0
+    %1:_(s8) = COPY $b1
+    %2:_(s8) = COPY $b2
+    %3:_(s1) = G_TRUNC %2
+    %4:_(s8), %5:_(s1) = G_SADDE %0, %1, %3
+...
+---
+name:            ScalarPartKnown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @ScalarPartKnown
+  ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:00001111 SignBits:4
+  ; CHECK-NEXT: %2:_ KnownBits:0000???? SignBits:4
+  ; CHECK-NEXT: %3:_ KnownBits:00000101 SignBits:5
+  ; CHECK-NEXT: %4:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:000????? SignBits:3
+  ; CHECK-NEXT: %7:_ KnownBits:? SignBits:1
+    %0:_(s8) = COPY $b0
+    %1:_(s8) = G_CONSTANT i8 15
+    %2:_(s8) = G_AND %0, %1
+    %3:_(s8) = G_CONSTANT i8 5
+    %4:_(s8) = COPY $b1
+    %5:_(s1) = G_TRUNC %4
+    %6:_(s8), %7:_(s1) = G_SADDE %2, %3, %5
+...
+---
+name:            VectorCstCarryInZeroOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryInZeroOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %4:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:0111110100000010 SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 2
+    %1:_(s16) = G_CONSTANT i16 32000
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %4:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %5:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
+    %6:_(<4 x s16>), %7:_(<4 x s1>) = G_SADDE %3, %4, %5
+...
+---
+name:            VectorCstCarryInOneOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryInOneOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %4:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:0111110100000011 SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 2
+    %1:_(s16) = G_CONSTANT i16 32000
+    %2:_(s1) = G_CONSTANT i1 1
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %4:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %5:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
+    %6:_(<4 x s16>), %7:_(<4 x s1>) = G_SADDE %3, %4, %5
+...
+---
+name:            VectorCstCarryInZeroOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryInZeroOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %4:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:1000000000000001 SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 2
+    %1:_(s16) = G_CONSTANT i16 32767
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %4:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %5:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
+    %6:_(<4 x s16>), %7:_(<4 x s1>) = G_SADDE %3, %4, %5
+...
+---
+name:            VectorCstCarryInOneOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryInOneOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000000 SignBits:16
+  ; CHECK-NEXT: %1:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:0000000000000000 SignBits:16
+  ; CHECK-NEXT: %4:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:1000000000000000 SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 0
+    %1:_(s16) = G_CONSTANT i16 32767
+    %2:_(s1) = G_CONSTANT i1 1
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %4:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %5:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %2, %2
+    %6:_(<4 x s16>), %7:_(<4 x s1>) = G_SADDE %3, %4, %5
+...
+---
+name:            VectorVar
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorVar
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(<4 x s16>) = COPY $d1
+    %2:_(<4 x s16>) = COPY $d2
+    %3:_(<4 x s1>) = G_TRUNC %2
+    %4:_(<4 x s16>), %5:_(<4 x s1>) = G_SADDE %0, %1, %3
+...
+---
+name:            VectorPartKnown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorPartKnown
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:0000000011111111 SignBits:8
+  ; CHECK-NEXT: %2:_ KnownBits:0000000011111111 SignBits:8
+  ; CHECK-NEXT: %3:_ KnownBits:00000000???????? SignBits:8
+  ; CHECK-NEXT: %4:_ KnownBits:0000000000101010 SignBits:10
+  ; CHECK-NEXT: %5:_ KnownBits:0000000001001010 SignBits:9
+  ; CHECK-NEXT: %6:_ KnownBits:000000000??01010 SignBits:9
+  ; CHECK-NEXT: %7:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %8:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %9:_ KnownBits:0000000????????? SignBits:7
+  ; CHECK-NEXT: %10:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(s16) = G_CONSTANT i16 255
+    %2:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %3:_(<4 x s16>) = G_AND %0, %2
+    %4:_(s16) = G_CONSTANT i16 42
+    %5:_(s16) = G_CONSTANT i16 74
+    %6:_(<4 x s16>) = G_BUILD_VECTOR %4, %5, %5, %4
+    %7:_(<4 x s16>) = COPY $d2
+    %8:_(<4 x s1>) = G_TRUNC %2
+    %9:_(<4 x s16>), %10:_(<4 x s1>) = G_SADDE %6, %3, %8
+...
+---
+name:            VectorCst36
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCst36
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000011 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0000000000000110 SignBits:13
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:0000000000000?1? SignBits:13
+  ; CHECK-NEXT: %5:_ KnownBits:0000000000000?1? SignBits:13
+  ; CHECK-NEXT: %6:_ KnownBits:? SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:000000000000???? SignBits:12
+  ; CHECK-NEXT: %8:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 3
+    %1:_(s16) = G_CONSTANT i16 6
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(s1) = G_CONSTANT i1 1
+    %4:_(<4 x s16>) = G_BUILD_VECTOR %0, %1, %1, %0
+    %5:_(<4 x s16>) = G_BUILD_VECTOR %0, %1, %1, %0
+    %6:_(<4 x s1>) = G_BUILD_VECTOR %2, %2, %3, %3
+    %7:_(<4 x s16>), %8:_(<4 x s1>) = G_SADDE %4, %5, %6
+...
+---
+name:            VectorCst3unknown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCst3unknown
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0000000000000011 SignBits:14
+  ; CHECK-NEXT: %3:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:1 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %6:_ KnownBits:? SignBits:1
+  ; CHECK-NEXT: %7:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %8:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(s16) = COPY $h0
+    %2:_(s16) = G_CONSTANT i16 3
+    %3:_(s1) = G_CONSTANT i1 0
+    %4:_(s1) = G_CONSTANT i1 1
+    %5:_(<4 x s16>) = G_BUILD_VECTOR %1, %2, %2, %1
+    %6:_(<4 x s1>) = G_BUILD_VECTOR %3, %3, %4, %4
+    %7:_(<4 x s16>), %8:_(<4 x s1>) = G_SADDE %0, %5, %6
+...
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-saddo.mir b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-saddo.mir
new file mode 100644
index 0000000000000..9fac33e341c13
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-saddo.mir
@@ -0,0 +1,163 @@
+# NOTE: Assertions have been autogenerated by utils/update_givaluetracking_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -mtriple=aarch64 -passes="print<gisel-value-tracking>" -filetype=null %s 2>&1 | FileCheck %s
+
+---
+name:            CstCarryOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:00011000 SignBits:3
+  ; CHECK-NEXT: %2:_ KnownBits:00011010 SignBits:3
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 24
+    %2:_(s8), %3:_(s1) = G_SADDO %0, %1
+...
+---
+name:            CstCarryOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:01111110 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:10000000 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 126
+    %2:_(s8), %3:_(s1) = G_SADDO %0, %1
+...
+---
+name:            ScalarVar
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @ScalarVar
+  ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+    %0:_(s8) = COPY $b0
+    %1:_(s8) = COPY $b1
+    %2:_(s8), %3:_(s1) = G_SADDO %0, %1
+...
+---
+name:            ScalarPartKnown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @ScalarPartKnown
+  ; CHECK-NEXT: %0:_ KnownBits:???????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:00001111 SignBits:4
+  ; CHECK-NEXT: %2:_ KnownBits:0000???? SignBits:4
+  ; CHECK-NEXT: %3:_ KnownBits:00000101 SignBits:5
+  ; CHECK-NEXT: %4:_ KnownBits:000????? SignBits:3
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(s8) = COPY $b0
+    %1:_(s8) = G_CONSTANT i8 15
+    %2:_(s8) = G_AND %0, %1
+    %3:_(s8) = G_CONSTANT i8 5
+    %4:_(s8), %5:_(s1) = G_SADDO %2, %3
+...
+---
+name:            VectorCstCarryOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %3:_ KnownBits:0111110100000000 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:0111110100000010 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 2
+    %1:_(s16) = G_CONSTANT i16 32000
+    %2:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %4:_(<4 x s16>), %5:_(<4 x s1>) = G_SADDO %2, %3
+...
+---
+name:            VectorCstCarryOutOne
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCstCarryOutOne
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0000000000000010 SignBits:14
+  ; CHECK-NEXT: %3:_ KnownBits:0111111111111111 SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:1000000000000001 SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 2
+    %1:_(s16) = G_CONSTANT i16 32767
+    %2:_(<4 x s16>) = G_BUILD_VECTOR %0, %0, %0, %0
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %4:_(<4 x s16>), %5:_(<4 x s1>) = G_SADDO %2, %3
+...
+---
+name:            VectorVar
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorVar
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(<4 x s16>) = COPY $d1
+    %2:_(<4 x s16>), %3:_(<4 x s1>) = G_SADDO %0, %1
+...
+---
+name:            VectorPartKnown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorPartKnown
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:0000000011111111 SignBits:8
+  ; CHECK-NEXT: %2:_ KnownBits:0000000011111111 SignBits:8
+  ; CHECK-NEXT: %3:_ KnownBits:00000000???????? SignBits:8
+  ; CHECK-NEXT: %4:_ KnownBits:0000000000101010 SignBits:10
+  ; CHECK-NEXT: %5:_ KnownBits:0000000001001010 SignBits:9
+  ; CHECK-NEXT: %6:_ KnownBits:000000000??01010 SignBits:9
+  ; CHECK-NEXT: %7:_ KnownBits:0000000????????? SignBits:7
+  ; CHECK-NEXT: %8:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(s16) = G_CONSTANT i16 255
+    %2:_(<4 x s16>) = G_BUILD_VECTOR %1, %1, %1, %1
+    %3:_(<4 x s16>) = G_AND %0, %2
+    %4:_(s16) = G_CONSTANT i16 42
+    %5:_(s16) = G_CONSTANT i16 74
+    %6:_(<4 x s16>) = G_BUILD_VECTOR %4, %5, %5, %4
+    %7:_(<4 x s16>), %8:_(<4 x s1>) = G_SADDO %6, %3
+...
+---
+name:            VectorCst36
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCst36
+  ; CHECK-NEXT: %0:_ KnownBits:0000000000000011 SignBits:14
+  ; CHECK-NEXT: %1:_ KnownBits:0000000000000110 SignBits:13
+  ; CHECK-NEXT: %2:_ KnownBits:0000000000000?1? SignBits:13
+  ; CHECK-NEXT: %3:_ KnownBits:0000000000000?1? SignBits:13
+  ; CHECK-NEXT: %4:_ KnownBits:000000000000???? SignBits:12
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(s16) = G_CONSTANT i16 3
+    %1:_(s16) = G_CONSTANT i16 6
+    %2:_(<4 x s16>) = G_BUILD_VECTOR %0, %1, %1, %0
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %0, %1, %1, %0
+    %4:_(<4 x s16>), %5:_(<4 x s1>) = G_SADDO %2, %3
+...
+---
+name:            VectorCst3unknown
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @VectorCst3unknown
+  ; CHECK-NEXT: %0:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %1:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %2:_ KnownBits:0000000000000011 SignBits:14
+  ; CHECK-NEXT: %3:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %4:_ KnownBits:???????????????? SignBits:1
+  ; CHECK-NEXT: %5:_ KnownBits:? SignBits:1
+    %0:_(<4 x s16>) = COPY $d0
+    %1:_(s16) = COPY $h0
+    %2:_(s16) = G_CONSTANT i16 3
+    %3:_(<4 x s16>) = G_BUILD_VECTOR %1, %2, %2, %1
+    %4:_(<4 x s16>), %5:_(<4 x s1>) = G_SADDO %0, %3
+...
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uadde.mir b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uadde.mir
new file mode 100644
index 0000000000000..9fcbfdf0ae311
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uadde.mir
@@ -0,0 +1,275 @@
+# NOTE: Assertions have been autogenerated by utils/update_givaluetracking_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -mtriple=aarch64 -passes="print<gisel-value-tracking>" -filetype=null %s 2>&1 | FileCheck %s
+
+---
+name:            CstCarryInZeroOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInZeroOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBits:6
+  ; CHECK-NEXT: %1:_ KnownBits:00011000 SignBits:3
+  ; CHECK-NEXT: %2:_ KnownBits:0 SignBits:1
+  ; CHECK-NEXT: %3:_ KnownBits:00011010 SignBits:3
+  ; CHECK-NEXT: %4:_ KnownBits:? SignBits:1
+    %0:_(s8) = G_CONSTANT i8 2
+    %1:_(s8) = G_CONSTANT i8 24
+    %2:_(s1) = G_CONSTANT i1 0
+    %3:_(s8), %4:_(s1) = G_UADDE %0, %1, %2
+...
+---
+name:            CstCarryInOneOutZero
+body:             |
+  bb.1:
+  ; CHECK-LABEL: name: @CstCarryInOneOutZero
+  ; CHECK-NEXT: %0:_ KnownBits:00000010 SignBit...
[truncated]

@RKSimon RKSimon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM - cheers

@ningxinr ningxinr merged commit 6c81859 into llvm:main Dec 30, 2025
15 checks passed
@llvm-ci

llvm-ci commented Dec 31, 2025

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot1 while building llvm at step 2 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 94948 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll (58504 of 94948)
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll    /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll
# note: command had no output on stdout or stderr
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout    -jd extra -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll -jd main /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -jd extra -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll -jd main /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll
# .---command stderr------------
# | JIT session error: In graph /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll.submodule.0x87a6134c4bf713ec.ll-jitted-objectbuffer, section .text: relocation target 0x767b4c44202c (__orc_lcl.str3.3:0x767b4c442030 + 0xfffffffffffffffc) is out of range of Delta32 fixup at address 0x767b4c442030 (printf_wrapper, 0x727b4b064000 + 0x3)
# | JIT session error: Failed to materialize symbols: { (extra.impl, { printf_wrapper }) }
# `-----------------------------
# error: command failed with exit status: 1
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# .---command stderr------------
# | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll:16:10: error: CHECK: expected string not found in input
# | ; CHECK: Goodbye from destructor
# |          ^
# | <stdin>:14:26: note: scanning from here
# | Goodbye from __cxa_atexit
# |                          ^
# | <stdin>:15:3: note: possible intended match here
# | [ printf_wrapper ]
# |   ^
# | 
# | Input file: <stdin>
# | Check file: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
Step 11 (stage2/asan check) failure: stage2/asan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:564: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 94948 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll (58504 of 94948)
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll    /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll
# note: command had no output on stdout or stderr
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout    -jd extra -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll -jd main /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lli -jit-kind=orc-lazy -orc-lazy-debug=funcs-to-stdout -jd extra -extra-module /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll -jd main /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/Inputs/noop-main.ll
# .---command stderr------------
# | JIT session error: In graph /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll.submodule.0x87a6134c4bf713ec.ll-jitted-objectbuffer, section .text: relocation target 0x767b4c44202c (__orc_lcl.str3.3:0x767b4c442030 + 0xfffffffffffffffc) is out of range of Delta32 fixup at address 0x767b4c442030 (printf_wrapper, 0x727b4b064000 + 0x3)
# | JIT session error: Failed to materialize symbols: { (extra.impl, { printf_wrapper }) }
# `-----------------------------
# error: command failed with exit status: 1
# executed command: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# .---command stderr------------
# | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll:16:10: error: CHECK: expected string not found in input
# | ; CHECK: Goodbye from destructor
# |          ^
# | <stdin>:14:26: note: scanning from here
# | Goodbye from __cxa_atexit
# |                          ^
# | <stdin>:15:3: note: possible intended match here
# | [ printf_wrapper ]
# |   ^
# | 
# | Input file: <stdin>
# | Check file: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/test/ExecutionEngine/OrcLazy/global-ctors-and-dtors.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jan 6, 2026
…wnBits (llvm#165497)

Addressing the carry out cases Matt mentioned in llvm#159202.

Note: G_[US]SUB[OE] will be implemented in a different PR.
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.

4 participants