aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2024-04-18 08:34:51 -0700
committerGitHub <noreply@github.com>2024-04-18 08:34:51 -0700
commitba1158813d4656585c7e345747bc4db4e3f03b9d (patch)
treeff759d48d6c6cd48d0825c830f3b2ad87828b786 /llvm/lib/CodeGen
parentd8a26ca323977035969813b0e1e9fb54fd334620 (diff)
downloadllvm-ba1158813d4656585c7e345747bc4db4e3f03b9d.tar.gz
llvm-ba1158813d4656585c7e345747bc4db4e3f03b9d.tar.bz2
llvm-ba1158813d4656585c7e345747bc4db4e3f03b9d.zip
[DAGCombiner][AArch64] Make combineCarryDiamond avoid creating UADDO_CARRY with carry in larger than setcc result type. (#89121)
In the attach test case we were creating a UADDO_CARRY with i1 carry out and i41 carry in. i41 exceeds is larger than the setcc result type for AArch64 which is i32. i41 needs to be promoted to i64 since it is larger than i32. The type legalizer tried to use promoteTargetBoolean, but that can only promote from a type smaller than setcc result type. The easiest fix here is to force the carryin type to match the carryout type at the type of creation. This should ensure the node won't exceeed setcc result type as long as the output type doesn't. I think we should explore requiring the types to match for this node. Fixes #88966
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6ac7d4ee95fb..0ea0c0df7f37 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3520,6 +3520,8 @@ static SDValue combineCarryDiamond(SelectionDAG &DAG, const TargetLowering &TLI,
return SDValue();
SDLoc DL(N);
+ CarryIn = DAG.getBoolExtOrTrunc(CarryIn, DL, Carry1->getValueType(1),
+ Carry1->getValueType(0));
SDValue Merged =
DAG.getNode(NewOp, DL, Carry1->getVTList(), Carry0.getOperand(0),
Carry0.getOperand(1), CarryIn);