Skip to content

Commit a10ddf7

Browse files
committed
[RISCV] Plumb in a SDNode* to TargetLowering::shouldNormalizeToSelectSequence
Will need the extra information for RISCV lowering.
1 parent a5bc43e commit a10ddf7

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,8 +2489,8 @@ class LLVM_ABI TargetLoweringBase {
24892489
/// select(N0|N1, X, Y) => select(N0, select(N1, X, Y, Y)) if it is likely
24902490
/// that it saves us from materializing N0 and N1 in an integer register.
24912491
/// Targets that are able to perform and/or on flags should return false here.
2492-
virtual bool shouldNormalizeToSelectSequence(LLVMContext &Context,
2493-
EVT VT) const {
2492+
virtual bool shouldNormalizeToSelectSequence(LLVMContext &Context, EVT VT,
2493+
SDNode *) const {
24942494
// If a target has multiple condition registers, then it likely has logical
24952495
// operations on those registers.
24962496
if (hasMultipleConditionRegisters(VT))

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12387,7 +12387,7 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
1238712387
// and we always transform to the left side if we know that we can further
1238812388
// optimize the combination of the conditions.
1238912389
bool normalizeToSequence =
12390-
TLI.shouldNormalizeToSelectSequence(*DAG.getContext(), VT);
12390+
TLI.shouldNormalizeToSelectSequence(*DAG.getContext(), VT, N);
1239112391
// select (and Cond0, Cond1), X, Y
1239212392
// -> select Cond0, (select Cond1, X, Y), Y
1239312393
if (N0->getOpcode() == ISD::AND && N0->hasOneUse()) {

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29457,8 +29457,8 @@ bool AArch64TargetLowering::functionArgumentNeedsConsecutiveRegisters(
2945729457
return all_equal(ValueVTs);
2945829458
}
2945929459

29460-
bool AArch64TargetLowering::shouldNormalizeToSelectSequence(LLVMContext &,
29461-
EVT) const {
29460+
bool AArch64TargetLowering::shouldNormalizeToSelectSequence(LLVMContext &, EVT,
29461+
SDNode *) const {
2946229462
return false;
2946329463
}
2946429464

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ class AArch64TargetLowering : public TargetLowering {
867867
SmallVectorImpl<SDValue> &Results,
868868
SelectionDAG &DAG) const;
869869

870-
bool shouldNormalizeToSelectSequence(LLVMContext &, EVT) const override;
870+
bool shouldNormalizeToSelectSequence(LLVMContext &, EVT,
871+
SDNode *) const override;
871872

872873
void finalizeLowering(MachineFunction &MF) const override;
873874

llvm/lib/Target/RISCV/RISCVISelLowering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ class RISCVTargetLowering : public TargetLowering {
607607
/// select(N0&N1, X, Y) => select(N0, select(N1, X, Y), Y) and
608608
/// select(N0|N1, X, Y) => select(N0, select(N1, X, Y, Y))
609609
/// RISC-V doesn't have flags so it's better to perform the and/or in a GPR.
610-
bool shouldNormalizeToSelectSequence(LLVMContext &, EVT) const override {
610+
bool shouldNormalizeToSelectSequence(LLVMContext &, EVT,
611+
SDNode *N) const override {
611612
return false;
612613
}
613614

0 commit comments

Comments
 (0)