Skip to content

Commit 1d1dd2a

Browse files
committed
Merge from 'main' to 'sycl-web' (15 commits)
CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.td
2 parents 1df2347 + 1721404 commit 1d1dd2a

File tree

27 files changed

+860
-140
lines changed

27 files changed

+860
-140
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ def Xsycl_linker_EQ : JoinedAndSeparate<["-"], "Xsycl-target-linker=">,
856856
MetaVarName<"<triple> <arg>">, Flags<[CoreOption]>;
857857
def Xs : Joined<["-"], "Xs">, HelpText<"Pass <arg> to the offline compiler, adding the option specifier '-' to the <arg>.">, MetaVarName<"<arg>">, Flags<[CoreOption]>;
858858
def Xs_separate : Separate<["-"], "Xs">, HelpText<"Pass <arg> to the offline compiler.">, MetaVarName<"<arg>">, Flags<[CoreOption]>;
859-
def z : Separate<["-"], "z">, Flags<[LinkerInput, RenderAsInput]>,
859+
def z : Separate<["-"], "z">, Flags<[LinkerInput]>,
860860
HelpText<"Pass -z <arg> to the linker">, MetaVarName<"<arg>">,
861861
Group<Link_Group>;
862862
def offload_link : Flag<["--", "-"], "offload-link">, Group<Link_Group>,
@@ -881,8 +881,8 @@ def autocomplete : Joined<["--"], "autocomplete=">;
881881
def bind__at__load : Flag<["-"], "bind_at_load">;
882882
def bundle__loader : Separate<["-"], "bundle_loader">;
883883
def bundle : Flag<["-"], "bundle">;
884-
def b : JoinedOrSeparate<["-"], "b">, Flags<[LinkerInput, RenderAsInput]>,
885-
HelpText<"Pass -b <arg> to the linker on AIX (only).">, MetaVarName<"<arg>">,
884+
def b : JoinedOrSeparate<["-"], "b">, Flags<[LinkerInput]>,
885+
HelpText<"Pass -b <arg> to the linker on AIX">, MetaVarName<"<arg>">,
886886
Group<Link_Group>;
887887
// OpenCL-only Options
888888
def cl_opt_disable : Flag<["-"], "cl-opt-disable">, Group<opencl_Group>, Flags<[CC1Option]>,
@@ -4216,7 +4216,7 @@ def nostdlibxx : Flag<["-"], "nostdlib++">, Group<Link_Group>;
42164216
def nolibsycl : Flag<["-"], "nolibsycl">, Flags<[NoXarchOption, CoreOption]>,
42174217
HelpText<"Do not link SYCL runtime library">;
42184218
def object : Flag<["-"], "object">;
4219-
def o : JoinedOrSeparate<["-"], "o">, Flags<[NoXarchOption, RenderAsInput,
4219+
def o : JoinedOrSeparate<["-"], "o">, Flags<[NoXarchOption,
42204220
CC1Option, CC1AsOption, FC1Option, FlangOption]>,
42214221
HelpText<"Write output to <file>">, MetaVarName<"<file>">,
42224222
MarshallingInfoString<FrontendOpts<"OutputFile">>;

lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,23 @@ GDBRemoteClientBase::SendPacketAndWaitForResponse(
194194
return SendPacketAndWaitForResponseNoLock(payload, response);
195195
}
196196

197+
GDBRemoteCommunication::PacketResult
198+
GDBRemoteClientBase::ReadPacketWithOutputSupport(
199+
StringExtractorGDBRemote &response, Timeout<std::micro> timeout,
200+
bool sync_on_timeout,
201+
llvm::function_ref<void(llvm::StringRef)> output_callback) {
202+
auto result = ReadPacket(response, timeout, sync_on_timeout);
203+
while (result == PacketResult::Success && response.IsNormalResponse() &&
204+
response.PeekChar() == 'O') {
205+
response.GetChar();
206+
std::string output;
207+
if (response.GetHexByteString(output))
208+
output_callback(output);
209+
result = ReadPacket(response, timeout, sync_on_timeout);
210+
}
211+
return result;
212+
}
213+
197214
GDBRemoteCommunication::PacketResult
198215
GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport(
199216
llvm::StringRef payload, StringExtractorGDBRemote &response,

lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class GDBRemoteClientBase : public GDBRemoteCommunication, public Broadcaster {
5858
llvm::StringRef payload, StringExtractorGDBRemote &response,
5959
std::chrono::seconds interrupt_timeout = std::chrono::seconds(0));
6060

61+
PacketResult ReadPacketWithOutputSupport(
62+
StringExtractorGDBRemote &response, Timeout<std::micro> timeout,
63+
bool sync_on_timeout,
64+
llvm::function_ref<void(llvm::StringRef)> output_callback);
65+
6166
PacketResult SendPacketAndReceiveResponseWithOutputSupport(
6267
llvm::StringRef payload, StringExtractorGDBRemote &response,
6368
std::chrono::seconds interrupt_timeout,

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,6 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunication::GetAck() {
220220
return result;
221221
}
222222

223-
GDBRemoteCommunication::PacketResult
224-
GDBRemoteCommunication::ReadPacketWithOutputSupport(
225-
StringExtractorGDBRemote &response, Timeout<std::micro> timeout,
226-
bool sync_on_timeout,
227-
llvm::function_ref<void(llvm::StringRef)> output_callback) {
228-
auto result = ReadPacket(response, timeout, sync_on_timeout);
229-
while (result == PacketResult::Success && response.IsNormalResponse() &&
230-
response.PeekChar() == 'O') {
231-
response.GetChar();
232-
std::string output;
233-
if (response.GetHexByteString(output))
234-
output_callback(output);
235-
result = ReadPacket(response, timeout, sync_on_timeout);
236-
}
237-
return result;
238-
}
239-
240223
GDBRemoteCommunication::PacketResult
241224
GDBRemoteCommunication::ReadPacket(StringExtractorGDBRemote &response,
242225
Timeout<std::micro> timeout,

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ class GDBRemoteCommunication : public Communication {
190190
PacketResult ReadPacket(StringExtractorGDBRemote &response,
191191
Timeout<std::micro> timeout, bool sync_on_timeout);
192192

193-
PacketResult ReadPacketWithOutputSupport(
194-
StringExtractorGDBRemote &response, Timeout<std::micro> timeout,
195-
bool sync_on_timeout,
196-
llvm::function_ref<void(llvm::StringRef)> output_callback);
197-
198193
PacketResult WaitForPacketNoLock(StringExtractorGDBRemote &response,
199194
Timeout<std::micro> timeout,
200195
bool sync_on_timeout);

llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,13 @@ class CombinerHelper {
756756
bool matchBuildVectorIdentityFold(MachineInstr &MI, Register &MatchInfo);
757757
bool matchTruncBuildVectorFold(MachineInstr &MI, Register &MatchInfo);
758758

759+
/// Transform:
760+
/// (x + y) - y -> x
761+
/// (x + y) - x -> y
762+
/// x - (y + x) -> 0 - y
763+
/// x - (x + z) -> 0 - z
764+
bool matchSubAddSameReg(MachineInstr &MI, BuildFnTy &MatchInfo);
765+
759766
/// \returns true if it is possible to simplify a select instruction \p MI
760767
/// to a min/max instruction of some sort.
761768
bool matchSimplifySelectToMinMax(MachineInstr &MI, BuildFnTy &MatchInfo);

llvm/include/llvm/Target/GlobalISel/Combine.td

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,17 @@ def trunc_buildvector_fold : GICombineRule<
950950
[{ return Helper.matchTruncBuildVectorFold(*${op}, ${matchinfo}); }]),
951951
(apply [{ Helper.replaceSingleDefInstWithReg(*${op}, ${matchinfo}); }])>;
952952

953+
// Transform:
954+
// (x + y) - y -> x
955+
// (x + y) - x -> y
956+
// x - (y + x) -> 0 - y
957+
// x - (x + z) -> 0 - z
958+
def sub_add_reg: GICombineRule <
959+
(defs root:$root, build_fn_matchinfo:$matchinfo),
960+
(match (wip_match_opcode G_SUB):$root,
961+
[{ return Helper.matchSubAddSameReg(*${root}, ${matchinfo}); }]),
962+
(apply [{ Helper.applyBuildFn(*${root}, ${matchinfo}); }])>;
963+
953964
def select_to_minmax: GICombineRule<
954965
(defs root:$root, build_fn_matchinfo:$info),
955966
(match (wip_match_opcode G_SELECT):$root,
@@ -1019,7 +1030,8 @@ def all_combines : GICombineGroup<[trivial_combines, insert_vec_elt_combines,
10191030
truncstore_merge, div_rem_to_divrem, funnel_shift_combines,
10201031
form_bitfield_extract, constant_fold, fabs_fneg_fold,
10211032
intdiv_combines, mulh_combines, redundant_neg_operands,
1022-
and_or_disjoint_mask, fma_combines, fold_binop_into_select]>;
1033+
and_or_disjoint_mask, fma_combines, fold_binop_into_select,
1034+
sub_add_reg]>;
10231035

10241036
// A combine group used to for prelegalizer combiners at -O0. The combines in
10251037
// this group have been selected based on experiments to balance code size and

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,6 +4825,50 @@ bool CombinerHelper::matchAddEToAddO(MachineInstr &MI, BuildFnTy &MatchInfo) {
48254825
return true;
48264826
}
48274827

4828+
bool CombinerHelper::matchSubAddSameReg(MachineInstr &MI,
4829+
BuildFnTy &MatchInfo) {
4830+
assert(MI.getOpcode() == TargetOpcode::G_SUB);
4831+
Register Dst = MI.getOperand(0).getReg();
4832+
// (x + y) - z -> x (if y == z)
4833+
// (x + y) - z -> y (if x == z)
4834+
Register X, Y, Z;
4835+
if (mi_match(Dst, MRI, m_GSub(m_GAdd(m_Reg(X), m_Reg(Y)), m_Reg(Z)))) {
4836+
Register ReplaceReg;
4837+
int64_t CstX, CstY;
4838+
if (Y == Z || (mi_match(Y, MRI, m_ICstOrSplat(CstY)) &&
4839+
mi_match(Z, MRI, m_SpecificICstOrSplat(CstY))))
4840+
ReplaceReg = X;
4841+
else if (X == Z || (mi_match(X, MRI, m_ICstOrSplat(CstX)) &&
4842+
mi_match(Z, MRI, m_SpecificICstOrSplat(CstX))))
4843+
ReplaceReg = Y;
4844+
if (ReplaceReg) {
4845+
MatchInfo = [=](MachineIRBuilder &B) { B.buildCopy(Dst, ReplaceReg); };
4846+
return true;
4847+
}
4848+
}
4849+
4850+
// x - (y + z) -> 0 - y (if x == z)
4851+
// x - (y + z) -> 0 - z (if x == y)
4852+
if (mi_match(Dst, MRI, m_GSub(m_Reg(X), m_GAdd(m_Reg(Y), m_Reg(Z))))) {
4853+
Register ReplaceReg;
4854+
int64_t CstX;
4855+
if (X == Z || (mi_match(X, MRI, m_ICstOrSplat(CstX)) &&
4856+
mi_match(Z, MRI, m_SpecificICstOrSplat(CstX))))
4857+
ReplaceReg = Y;
4858+
else if (X == Y || (mi_match(X, MRI, m_ICstOrSplat(CstX)) &&
4859+
mi_match(Y, MRI, m_SpecificICstOrSplat(CstX))))
4860+
ReplaceReg = Z;
4861+
if (ReplaceReg) {
4862+
MatchInfo = [=](MachineIRBuilder &B) {
4863+
auto Zero = B.buildConstant(MRI.getType(Dst), 0);
4864+
B.buildSub(Dst, Zero, ReplaceReg);
4865+
};
4866+
return true;
4867+
}
4868+
}
4869+
return false;
4870+
}
4871+
48284872
MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
48294873
assert(MI.getOpcode() == TargetOpcode::G_UDIV);
48304874
auto &UDiv = cast<GenericMachineInstr>(MI);

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19781,9 +19781,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
1978119781
if (InVec.isUndef() && TLI.shouldSplatInsEltVarIndex(VT)) {
1978219782
if (VT.isScalableVector())
1978319783
return DAG.getSplatVector(VT, DL, InVal);
19784-
19785-
SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), InVal);
19786-
return DAG.getBuildVector(VT, DL, Ops);
19784+
return DAG.getSplatBuildVector(VT, DL, InVal);
1978719785
}
1978819786
return SDValue();
1978919787
}
@@ -23821,8 +23819,7 @@ static SDValue scalarizeBinOpOfSplats(SDNode *N, SelectionDAG &DAG,
2382123819
// bo (splat X, Index), (splat Y, Index) --> splat (bo X, Y), Index
2382223820
if (VT.isScalableVector())
2382323821
return DAG.getSplatVector(VT, DL, ScalarBO);
23824-
SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), ScalarBO);
23825-
return DAG.getBuildVector(VT, DL, Ops);
23822+
return DAG.getSplatBuildVector(VT, DL, ScalarBO);
2382623823
}
2382723824

2382823825
/// Visit a binary vector operation, like ADD.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,10 +1697,7 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
16971697

16981698
if (isa<ScalableVectorType>(VecTy))
16991699
return NodeMap[V] = DAG.getSplatVector(VT, getCurSDLoc(), Op);
1700-
1701-
SmallVector<SDValue, 16> Ops;
1702-
Ops.assign(cast<FixedVectorType>(VecTy)->getNumElements(), Op);
1703-
return NodeMap[V] = DAG.getBuildVector(VT, getCurSDLoc(), Ops);
1700+
return NodeMap[V] = DAG.getSplatBuildVector(VT, getCurSDLoc(), Op);
17041701
}
17051702

17061703
llvm_unreachable("Unknown vector constant");

0 commit comments

Comments
 (0)