Skip to content

Commit f2c2651

Browse files
authored
Merge branch 'main' into hgh/libcxx/P2255R2-A_type_trait_to_detect_reference_binding_to_temporary
2 parents cba8f24 + 7521207 commit f2c2651

File tree

16 files changed

+461
-190
lines changed

16 files changed

+461
-190
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,6 +3205,28 @@ POST_SYSCALL(futex)
32053205
COMMON_SYSCALL_BLOCKING_END();
32063206
}
32073207

3208+
PRE_SYSCALL(copy_file_range)
3209+
(int fdin, __sanitizer___kernel_off_t *offin, int fdout,
3210+
__sanitizer___kernel_off_t *offout, SIZE_T size, unsigned int flags) {
3211+
if (offin != nullptr) {
3212+
PRE_READ(offin, sizeof(*offin));
3213+
}
3214+
if (offout != nullptr) {
3215+
PRE_READ(offout, sizeof(*offout));
3216+
}
3217+
}
3218+
3219+
POST_SYSCALL(copy_file_range)
3220+
(SSIZE_T, int fdin, __sanitizer___kernel_off_t *offin, int fdout,
3221+
__sanitizer___kernel_off_t *offout, SIZE_T size, unsigned int flags) {
3222+
if (offin != nullptr) {
3223+
POST_WRITE(offin, sizeof(*offin));
3224+
}
3225+
if (offout != nullptr) {
3226+
POST_WRITE(offout, sizeof(*offout));
3227+
}
3228+
}
3229+
32083230
} // extern "C"
32093231

32103232
# undef PRE_SYSCALL
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %clangxx -O0 %s -D_FILE_OFFSET_BITS=64 -o %t
2+
3+
// REQUIRES: glibc
4+
5+
#ifndef _GNU_SOURCE
6+
# define _GNU_SOURCE
7+
#endif
8+
#include <assert.h>
9+
#include <fcntl.h>
10+
#include <stdlib.h>
11+
#include <sys/syscall.h>
12+
#include <unistd.h>
13+
14+
#if !defined(__GLIBC_PREREQ)
15+
# define __GLIBC_PREREQ(a, b) 0
16+
#endif
17+
18+
#if !__GLIBC_PREREQ(2, 27)
19+
# define copy_file_range(a, b, c, d, e) \
20+
(ssize_t) syscall(__NR_copy_file_range, a, b, c, d, e)
21+
#endif
22+
23+
int main(void) {
24+
int fdin = open("/proc/self/maps", O_RDONLY);
25+
assert(fdin > 0);
26+
char tmp[] = "/tmp/map.XXXXXX";
27+
int fdout = mkstemp(tmp);
28+
assert(fdout > 0);
29+
off_t offin = -1, offout = 0;
30+
ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
31+
assert(cpy < 0);
32+
offin = 0;
33+
offout = 16;
34+
cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
35+
assert(cpy < 0);
36+
offout = 0;
37+
cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
38+
assert(cpy == 8);
39+
close(fdout);
40+
close(fdin);
41+
return 0;
42+
}

llvm/include/llvm/ADT/APFloat.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,11 +1543,16 @@ inline APFloat neg(APFloat X) {
15431543
return X;
15441544
}
15451545

1546-
/// Implements IEEE-754 2019 minimumNumber semantics. Returns the smaller of the
1547-
/// 2 arguments if both are not NaN. If either argument is a NaN, returns the
1548-
/// other argument. -0 is treated as ordered less than +0.
1546+
/// Implements IEEE-754 2008 minNum semantics. Returns the smaller of the
1547+
/// 2 arguments if both are not NaN. If either argument is a qNaN, returns the
1548+
/// other argument. If either argument is sNaN, return a qNaN.
1549+
/// -0 is treated as ordered less than +0.
15491550
LLVM_READONLY
15501551
inline APFloat minnum(const APFloat &A, const APFloat &B) {
1552+
if (A.isSignaling())
1553+
return A.makeQuiet();
1554+
if (B.isSignaling())
1555+
return B.makeQuiet();
15511556
if (A.isNaN())
15521557
return B;
15531558
if (B.isNaN())
@@ -1557,11 +1562,16 @@ inline APFloat minnum(const APFloat &A, const APFloat &B) {
15571562
return B < A ? B : A;
15581563
}
15591564

1560-
/// Implements IEEE-754 2019 maximumNumber semantics. Returns the larger of the
1561-
/// 2 arguments if both are not NaN. If either argument is a NaN, returns the
1562-
/// other argument. +0 is treated as ordered greater than -0.
1565+
/// Implements IEEE-754 2008 maxNum semantics. Returns the larger of the
1566+
/// 2 arguments if both are not NaN. If either argument is a qNaN, returns the
1567+
/// other argument. If either argument is sNaN, return a qNaN.
1568+
/// +0 is treated as ordered greater than -0.
15631569
LLVM_READONLY
15641570
inline APFloat maxnum(const APFloat &A, const APFloat &B) {
1571+
if (A.isSignaling())
1572+
return A.makeQuiet();
1573+
if (B.isSignaling())
1574+
return B.makeQuiet();
15651575
if (A.isNaN())
15661576
return B;
15671577
if (B.isNaN())

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,6 +4920,18 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
49204920
return false;
49214921
}
49224922

4923+
for (auto Op : {AMDGPU::OpName::src0_sel, AMDGPU::OpName::src1_sel,
4924+
AMDGPU::OpName::dst_sel}) {
4925+
const MachineOperand *MO = getNamedOperand(MI, Op);
4926+
if (!MO)
4927+
continue;
4928+
int64_t Imm = MO->getImm();
4929+
if (Imm < 0 || Imm > AMDGPU::SDWA::SdwaSel::DWORD) {
4930+
ErrInfo = "Invalid SDWA selection";
4931+
return false;
4932+
}
4933+
}
4934+
49234935
int DstIdx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::vdst);
49244936

49254937
for (int OpIdx : {DstIdx, Src0Idx, Src1Idx, Src2Idx}) {

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,10 @@ void RISCVELFStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
186186
MCELFStreamer::emitValueImpl(Value, Size, Loc);
187187
}
188188

189-
namespace llvm {
190-
MCELFStreamer *createRISCVELFStreamer(MCContext &C,
191-
std::unique_ptr<MCAsmBackend> MAB,
192-
std::unique_ptr<MCObjectWriter> MOW,
193-
std::unique_ptr<MCCodeEmitter> MCE) {
194-
RISCVELFStreamer *S =
195-
new RISCVELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE));
196-
return S;
197-
}
198-
} // namespace llvm
189+
MCStreamer *llvm::createRISCVELFStreamer(const Triple &, MCContext &C,
190+
std::unique_ptr<MCAsmBackend> &&MAB,
191+
std::unique_ptr<MCObjectWriter> &&MOW,
192+
std::unique_ptr<MCCodeEmitter> &&MCE) {
193+
return new RISCVELFStreamer(C, std::move(MAB), std::move(MOW),
194+
std::move(MCE));
195+
}

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ class RISCVTargetELFStreamer : public RISCVTargetStreamer {
6969
void finish() override;
7070
};
7171

72-
MCELFStreamer *createRISCVELFStreamer(MCContext &C,
73-
std::unique_ptr<MCAsmBackend> MAB,
74-
std::unique_ptr<MCObjectWriter> MOW,
75-
std::unique_ptr<MCCodeEmitter> MCE);
72+
MCStreamer *createRISCVELFStreamer(const Triple &, MCContext &C,
73+
std::unique_ptr<MCAsmBackend> &&MAB,
74+
std::unique_ptr<MCObjectWriter> &&MOW,
75+
std::unique_ptr<MCCodeEmitter> &&MCE);
7676
} // namespace llvm
7777

7878
#endif // LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVELFSTREAMER_H

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,6 @@ static MCInstrAnalysis *createRISCVInstrAnalysis(const MCInstrInfo *Info) {
340340
return new RISCVMCInstrAnalysis(Info);
341341
}
342342

343-
namespace {
344-
MCStreamer *createRISCVELFStreamer(const Triple &T, MCContext &Context,
345-
std::unique_ptr<MCAsmBackend> &&MAB,
346-
std::unique_ptr<MCObjectWriter> &&MOW,
347-
std::unique_ptr<MCCodeEmitter> &&MCE) {
348-
return createRISCVELFStreamer(Context, std::move(MAB), std::move(MOW),
349-
std::move(MCE));
350-
}
351-
} // end anonymous namespace
352-
353343
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTargetMC() {
354344
for (Target *T : {&getTheRISCV32Target(), &getTheRISCV64Target()}) {
355345
TargetRegistry::RegisterMCAsmInfo(*T, createRISCVMCAsmInfo);

0 commit comments

Comments
 (0)