-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[DAG] getCarry - always succeed if we encounter a i1 type during trunc/ext peeling #169777
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
Conversation
…c/ext peeling If we are reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes llvm#169691
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-selectiondag Author: Simon Pilgrim (RKSimon) ChangesIf we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes #169691 Full diff: https://github.com/llvm/llvm-project/pull/169777.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6b79dbb46cadc..0f3a207cc6414 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3288,6 +3288,9 @@ static SDValue getAsCarry(const TargetLowering &TLI, SDValue V,
// First, peel away TRUNCATE/ZERO_EXTEND/AND nodes due to legalization.
while (true) {
+ if (ForceCarryReconstruction && V.getValueType() == MVT::i1)
+ return V;
+
if (V.getOpcode() == ISD::TRUNCATE || V.getOpcode() == ISD::ZERO_EXTEND) {
V = V.getOperand(0);
continue;
@@ -3302,9 +3305,6 @@ static SDValue getAsCarry(const TargetLowering &TLI, SDValue V,
continue;
}
- if (ForceCarryReconstruction && V.getValueType() == MVT::i1)
- return V;
-
break;
}
diff --git a/llvm/test/CodeGen/X86/addcarry.ll b/llvm/test/CodeGen/X86/addcarry.ll
index f8a04f8514988..ee4482062df31 100644
--- a/llvm/test/CodeGen/X86/addcarry.ll
+++ b/llvm/test/CodeGen/X86/addcarry.ll
@@ -1517,18 +1517,9 @@ define i1 @pr84831(i64 %arg) {
define void @pr169691(ptr %p0, i64 %implicit, i1 zeroext %carry) {
; CHECK-LABEL: pr169691:
; CHECK: # %bb.0:
-; CHECK-NEXT: movq (%rdi), %rax
-; CHECK-NEXT: addq %rsi, %rax
-; CHECK-NEXT: setb %cl
-; CHECK-NEXT: movl %edx, %edx
-; CHECK-NEXT: addq %rax, %rdx
-; CHECK-NEXT: setb %al
-; CHECK-NEXT: orb %cl, %al
-; CHECK-NEXT: movq %rdx, (%rdi)
-; CHECK-NEXT: addq 8(%rdi), %rsi
-; CHECK-NEXT: movzbl %al, %eax
-; CHECK-NEXT: addq %rsi, %rax
-; CHECK-NEXT: movq %rax, 8(%rdi)
+; CHECK-NEXT: addb $-1, %dl
+; CHECK-NEXT: adcq %rsi, (%rdi)
+; CHECK-NEXT: adcq %rsi, 8(%rdi)
; CHECK-NEXT: retq
%a0 = load i64, ptr %p0, align 8
%uaddo0 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %a0, i64 %implicit)
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/211/builds/4185 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/19274 Here is the relevant piece of the build log for the reference |
…c/ext peeling (llvm#169777) If we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes llvm#169691
…c/ext peeling (llvm#169777) If we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes llvm#169691
…c/ext peeling (llvm#169777) If we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes llvm#169691
…c/ext peeling (llvm#169777) If we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop Fixes llvm#169691
If we are force reconstructing a carry from a raw MVT::i1 type, make sure we don't miss any cases while peeling through trunc/ext chains - check for i1 types at the start of the while loop
Fixes #169691