Skip to content

Commit 33e58ea

Browse files
RKSimonanonymouspc
authored andcommitted
[X86] combineVectorSizedSetCCEquality - convert to mayFoldIntoVector helper (llvm#172215)
Add AssumeSingleUse (default = false) argument to mayFoldIntoVector to allow us to match combineVectorSizedSetCCEquality behaviour with AssumeSingleUse=true Hopefully we can drop the AssumeSingleUse entirely soon, but there are a number of messy test regressions that need handling first
1 parent b7c78b3 commit 33e58ea

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,12 +2860,13 @@ bool X86::mayFoldIntoZeroExtend(SDValue Op) {
28602860
}
28612861

28622862
// Return true if its cheap to bitcast this to a vector type.
2863-
static bool mayFoldIntoVector(SDValue Op, const X86Subtarget &Subtarget) {
2863+
static bool mayFoldIntoVector(SDValue Op, const X86Subtarget &Subtarget,
2864+
bool AssumeSingleUse = false) {
28642865
if (peekThroughBitcasts(Op).getValueType().isVector())
28652866
return true;
28662867
if (isa<ConstantSDNode>(Op) || isa<ConstantFPSDNode>(Op))
28672868
return true;
2868-
return X86::mayFoldLoad(Op, Subtarget, /*AssumeSingleUse=*/false,
2869+
return X86::mayFoldLoad(Op, Subtarget, AssumeSingleUse,
28692870
/*IgnoreAlignment=*/true);
28702871
}
28712872

@@ -23122,12 +23123,9 @@ static SDValue combineVectorSizedSetCCEquality(EVT VT, SDValue X, SDValue Y,
2312223123
return SDValue();
2312323124

2312423125
// Don't perform this combine if constructing the vector will be expensive.
23125-
auto IsVectorBitCastCheap = [](SDValue X) {
23126-
X = peekThroughBitcasts(X);
23127-
return isa<ConstantSDNode>(X) || X.getValueType().isVector() ||
23128-
ISD::isNormalLoad(X.getNode());
23129-
};
23130-
if ((!IsVectorBitCastCheap(X) || !IsVectorBitCastCheap(Y)) &&
23126+
// TODO: Drop AssumeSingleUse = true override.
23127+
if ((!mayFoldIntoVector(X, Subtarget, /*AssumeSingleUse=*/true) ||
23128+
!mayFoldIntoVector(Y, Subtarget, /*AssumeSingleUse=*/true)) &&
2313123129
!IsOrXorXorTreeCCZero)
2313223130
return SDValue();
2313323131

0 commit comments

Comments
 (0)