Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14559,7 +14559,7 @@ static SDValue tryFoldSelectIntoOp(SDNode *N, SelectionDAG &DAG,
EVT VT = N->getValueType(0);
SDLoc DL(N);
SDValue OtherOp = TrueVal.getOperand(1 - OpToFold);
EVT OtherOpVT = OtherOp->getValueType(0);
EVT OtherOpVT = OtherOp.getValueType();
SDValue IdentityOperand =
DAG.getNeutralElement(Opc, DL, OtherOpVT, N->getFlags());
if (!Commutative)
Expand Down
19 changes: 19 additions & 0 deletions llvm/test/CodeGen/RISCV/pr90652.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s

define i1 @test(i64 %x, i1 %cond1, i1 %cond2) {
; CHECK-LABEL: test:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addi a3, a0, 1
; CHECK-NEXT: slt a0, a3, a0
; CHECK-NEXT: not a1, a1
; CHECK-NEXT: and a0, a1, a0
; CHECK-NEXT: or a0, a2, a0
; CHECK-NEXT: ret
entry:
%sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %x, i64 1)
%ov = extractvalue { i64, i1 } %sadd, 1
%or = or i1 %cond2, %ov
%sel = select i1 %cond1, i1 %cond2, i1 %or
ret i1 %sel
}