Skip to content

Commit c9f3a67

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merge upstream LLVM into amd-gfx12
2 parents eb75ede + ce86ff1 commit c9f3a67

32 files changed

+6071
-3049
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
/mlir/**/Transforms/SROA.* @moxinilian
130130

131131
# BOLT
132-
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9 @paschalis-mpeis
132+
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9 @paschalis-mpeis @yozhu
133133

134134
# Bazel build system.
135135
/utils/bazel/ @rupprecht @keith @aaronmondal

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ Bug Fixes to C++ Support
149149
- Diagnose binding a reference to ``*nullptr`` during constant evaluation. (#GH48665)
150150
- Suppress ``-Wdeprecated-declarations`` in implicitly generated functions. (#GH147293)
151151
- Fix a crash when deleting a pointer to an incomplete array (#GH150359).
152+
- Fix an assertion failure when expression in assumption attribute
153+
(``[[assume(expr)]]``) creates temporary objects.
152154

153155
Bug Fixes to AST Handling
154156
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaStmtAttr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,10 @@ ExprResult Sema::BuildCXXAssumeExpr(Expr *Assumption,
795795
if (Res.isInvalid())
796796
return ExprError();
797797

798+
Res = ActOnFinishFullExpr(Res.get(), /*DiscardedValue=*/false);
799+
if (Res.isInvalid())
800+
return ExprError();
801+
798802
Assumption = Res.get();
799803
if (Assumption->HasSideEffects(Context))
800804
Diag(Assumption->getBeginLoc(), diag::warn_assume_side_effects)

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,11 +2270,6 @@ TemplateInstantiator::TransformCXXAssumeAttr(const CXXAssumeAttr *AA) {
22702270
if (!Res.isUsable())
22712271
return AA;
22722272

2273-
Res = getSema().ActOnFinishFullExpr(Res.get(),
2274-
/*DiscardedValue=*/false);
2275-
if (!Res.isUsable())
2276-
return AA;
2277-
22782273
if (!(Res.get()->getDependence() & ExprDependence::TypeValueInstantiation)) {
22792274
Res = getSema().BuildCXXAssumeExpr(Res.get(), AA->getAttrName(),
22802275
AA->getRange());

clang/test/Parser/cxx23-assume.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ void f(int x, int y) {
55
[[assume(1)]];
66
[[assume(1.0)]];
77
[[assume(1 + 2 == 3)]];
8-
[[assume(x ? 1 : 2)]];
8+
[[assume(x ? 1 : 2)]]; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}}
99
[[assume(x && y)]];
1010
[[assume(true)]] [[assume(true)]];
1111

clang/test/SemaCXX/cxx23-assume.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
struct A{};
99
struct B{ explicit operator bool() { return true; } };
1010

11+
// This should be the first test case of this file.
12+
void IsActOnFinishFullExprCalled() {
13+
// Do not add other test cases to this function.
14+
// Make sure `ActOnFinishFullExpr` is called and creates `ExprWithCleanups`
15+
// to avoid assertion failure.
16+
[[assume(B{})]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}}
17+
}
18+
1119
template <bool cond>
1220
void f() {
1321
[[assume(cond)]]; // ext-warning {{C++23 extension}}

llvm/include/llvm/MC/MCObjectStreamer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class MCObjectStreamer : public MCStreamer {
8787
// Add a new fragment to the current section without a variable-size tail.
8888
void newFragment();
8989

90+
void appendContents(ArrayRef<char> Contents);
9091
void appendContents(size_t Num, char Elt);
9192
void addFixup(const MCExpr *Value, MCFixupKind Kind);
9293

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5949,8 +5949,7 @@ bool CombinerHelper::canCombineFMadOrFMA(MachineInstr &MI,
59495949
const TargetOptions &Options = MF->getTarget().Options;
59505950
LLT DstType = MRI.getType(MI.getOperand(0).getReg());
59515951

5952-
if (CanReassociate &&
5953-
!(Options.UnsafeFPMath || MI.getFlag(MachineInstr::MIFlag::FmReassoc)))
5952+
if (CanReassociate && !MI.getFlag(MachineInstr::MIFlag::FmReassoc))
59545953
return false;
59555954

59565955
// Floating-point multiply-add with intermediate rounding.
@@ -5962,8 +5961,7 @@ bool CombinerHelper::canCombineFMadOrFMA(MachineInstr &MI,
59625961
if (!HasFMAD && !HasFMA)
59635962
return false;
59645963

5965-
AllowFusionGlobally = Options.AllowFPOpFusion == FPOpFusion::Fast ||
5966-
Options.UnsafeFPMath || HasFMAD;
5964+
AllowFusionGlobally = Options.AllowFPOpFusion == FPOpFusion::Fast || HasFMAD;
59675965
// If the addition is not contractable, do not combine.
59685966
if (!AllowFusionGlobally && !MI.getFlag(MachineInstr::MIFlag::FmContract))
59695967
return false;

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8004,7 +8004,7 @@ LegalizerHelper::lowerFPTRUNC_F64_TO_F16(MachineInstr &MI) {
80048004
if (MRI.getType(Src).isVector()) // TODO: Handle vectors directly.
80058005
return UnableToLegalize;
80068006

8007-
if (MIRBuilder.getMF().getTarget().Options.UnsafeFPMath) {
8007+
if (MI.getFlag(MachineInstr::FmAfn)) {
80088008
unsigned Flags = MI.getFlags();
80098009
auto Src32 = MIRBuilder.buildFPTrunc(S32, Src, Flags);
80108010
MIRBuilder.buildFPTrunc(Dst, Src32, Flags);

llvm/lib/MC/MCMachOStreamer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ void MCMachOStreamer::finalizeCGProfile() {
484484
// For each entry, reserve space for 2 32-bit indices and a 64-bit count.
485485
size_t SectionBytes =
486486
W.getCGProfile().size() * (2 * sizeof(uint32_t) + sizeof(uint64_t));
487-
(*CGProfileSection->begin()).appendContents(SectionBytes, 0);
487+
(*CGProfileSection->begin())
488+
.setVarContents(std::vector<char>(SectionBytes, 0));
488489
}
489490

490491
MCStreamer *llvm::createMachOStreamer(MCContext &Context,
@@ -520,5 +521,6 @@ void MCMachOStreamer::createAddrSigSection() {
520521
// (instead of emitting a zero-sized section) so these relocations are
521522
// technically valid, even though we don't expect these relocations to
522523
// actually be applied by the linker.
523-
Frag->appendContents(8, 0);
524+
constexpr char zero[8] = {};
525+
Frag->setVarContents(zero);
524526
}

0 commit comments

Comments
 (0)