[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
https://github.com/ergawy approved this pull request. Nice! LGTM! https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
https://github.com/skatrak approved this pull request. Thank you Krzysztof, LGTM. https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
@@ -163,6 +163,43 @@ class AssociatedLoopChecker { std::map constructNamesAndLevels_; }; +bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) { + unsigned version{context_.langOptions().OpenMPVersion}; + DirectiveContext &dirCtx = GetContext(); + llvm::omp::Directive dir{dirCtx.directive}; + + if (!llvm::omp::isAllowedClauseForDirective(dir, clause, version)) { +unsigned allowedInVersion{[&] { + for (unsigned v : {45, 50, 51, 52, 60}) { +if (v <= version) { + continue; +} +if (llvm::omp::isAllowedClauseForDirective(dir, clause, v)) { + return v; +} + } + return 0u; +}()}; + +auto clauseName{parser::ToUpperCaseLetters(getClauseName(clause).str())}; +auto dirName{parser::ToUpperCaseLetters(getDirectiveName(dir).str())}; skatrak wrote: Nit: Perhaps move this into the `if` below to avoid evaluating it when it's not going to be needed. https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
https://github.com/skatrak edited https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
https://github.com/tblah approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64] Consistently use EmitToStreamer across the AArch64AsmPrinter (PR #110107)
https://github.com/atrosinenko created https://github.com/llvm/llvm-project/pull/110107 In preparation for refactoring the instruction size checks being made by PAuth-related code, switch all instruction emission in AArch64AsmPrinter to using EmitToStreamer function. Introduce a single-operand overload of `EmitToStreamer(MCInst)`, as the only MCStreamer passed as the first argument is actually `*OutStreamer`. To decrease the number of code lines changed due to clang-format, do not touch the existing calls to two-argument EmitToStreamer function so far. >From 06627f89a46f8b09fb763898c4dd17f874629604 Mon Sep 17 00:00:00 2001 From: Anatoly Trosinenko Date: Wed, 25 Sep 2024 14:36:53 +0300 Subject: [PATCH] [AArch64] Consistently use EmitToStreamer across the AArch64AsmPrinter In preparation for refactoring the instruction size checks being made by PAuth-related code, switch all instruction emission in AArch64AsmPrinter to using EmitToStreamer function. Introduce a single-operand overload of `EmitToStreamer(MCInst)`, as the only MCStreamer passed as the first argument is actually `*OutStreamer`. To decrease the number of code lines changed due to clang-format, do not touch the existing calls to two-argument EmitToStreamer function so far. --- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 374 -- 1 file changed, 166 insertions(+), 208 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index a82a081e4abfe9..47dd32ad2adc2f 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -165,6 +165,9 @@ class AArch64AsmPrinter : public AsmPrinter { bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst); void EmitToStreamer(MCStreamer &S, const MCInst &Inst); + void EmitToStreamer(const MCInst &Inst) { +EmitToStreamer(*OutStreamer, Inst); + } void emitInstruction(const MachineInstr *MI) override; @@ -648,12 +651,11 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) { OutStreamer->emitSymbolAttribute(Sym, MCSA_Hidden); OutStreamer->emitLabel(Sym); -OutStreamer->emitInstruction(MCInstBuilder(AArch64::SBFMXri) - .addReg(AArch64::X16) - .addReg(Reg) - .addImm(4) - .addImm(55), - *STI); +EmitToStreamer(MCInstBuilder(AArch64::SBFMXri) + .addReg(AArch64::X16) + .addReg(Reg) + .addImm(4) + .addImm(55)); if (IsFixedShadow) { // Aarch64 makes it difficult to embed large constants in the code. @@ -661,143 +663,118 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) { // left-shift option in the MOV instruction. Combined with the 16-bit // immediate, this is enough to represent any offset up to 2**48. emitMOVZ(AArch64::X17, FixedShadowOffset >> 32, 32); - OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRBBroX) - .addReg(AArch64::W16) - .addReg(AArch64::X17) - .addReg(AArch64::X16) - .addImm(0) - .addImm(0), - *STI); + EmitToStreamer(MCInstBuilder(AArch64::LDRBBroX) + .addReg(AArch64::W16) + .addReg(AArch64::X17) + .addReg(AArch64::X16) + .addImm(0) + .addImm(0)); } else { - OutStreamer->emitInstruction( - MCInstBuilder(AArch64::LDRBBroX) - .addReg(AArch64::W16) - .addReg(IsShort ? AArch64::X20 : AArch64::X9) - .addReg(AArch64::X16) - .addImm(0) - .addImm(0), - *STI); + EmitToStreamer(MCInstBuilder(AArch64::LDRBBroX) + .addReg(AArch64::W16) + .addReg(IsShort ? AArch64::X20 : AArch64::X9) + .addReg(AArch64::X16) + .addImm(0) + .addImm(0)); } -OutStreamer->emitInstruction( -MCInstBuilder(AArch64::SUBSXrs) -.addReg(AArch64::XZR) -.addReg(AArch64::X16) -.addReg(Reg) -.addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR, 56)), -*STI); +EmitToStreamer(MCInstBuilder(AArch64::SUBSXrs) + .addReg(AArch64::XZR) + .addReg(AArch64::X16) + .addReg(Reg) + .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR, 56))); MCSymbol *HandleMismatchOrPartialSym = OutContext.createTempSymbol(); -
[llvm-branch-commits] [llvm] [AArch64] Consistently use EmitToStreamer across the AArch64AsmPrinter (PR #110107)
llvmbot wrote: @llvm/pr-subscribers-backend-aarch64 Author: Anatoly Trosinenko (atrosinenko) Changes In preparation for refactoring the instruction size checks being made by PAuth-related code, switch all instruction emission in AArch64AsmPrinter to using EmitToStreamer function. Introduce a single-operand overload of `EmitToStreamer(MCInst)`, as the only MCStreamer passed as the first argument is actually `*OutStreamer`. To decrease the number of code lines changed due to clang-format, do not touch the existing calls to two-argument EmitToStreamer function so far. --- Patch is 22.09 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110107.diff 1 Files Affected: - (modified) llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp (+166-208) ``diff diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index a82a081e4abfe9..47dd32ad2adc2f 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -165,6 +165,9 @@ class AArch64AsmPrinter : public AsmPrinter { bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst); void EmitToStreamer(MCStreamer &S, const MCInst &Inst); + void EmitToStreamer(const MCInst &Inst) { +EmitToStreamer(*OutStreamer, Inst); + } void emitInstruction(const MachineInstr *MI) override; @@ -648,12 +651,11 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) { OutStreamer->emitSymbolAttribute(Sym, MCSA_Hidden); OutStreamer->emitLabel(Sym); -OutStreamer->emitInstruction(MCInstBuilder(AArch64::SBFMXri) - .addReg(AArch64::X16) - .addReg(Reg) - .addImm(4) - .addImm(55), - *STI); +EmitToStreamer(MCInstBuilder(AArch64::SBFMXri) + .addReg(AArch64::X16) + .addReg(Reg) + .addImm(4) + .addImm(55)); if (IsFixedShadow) { // Aarch64 makes it difficult to embed large constants in the code. @@ -661,143 +663,118 @@ void AArch64AsmPrinter::emitHwasanMemaccessSymbols(Module &M) { // left-shift option in the MOV instruction. Combined with the 16-bit // immediate, this is enough to represent any offset up to 2**48. emitMOVZ(AArch64::X17, FixedShadowOffset >> 32, 32); - OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRBBroX) - .addReg(AArch64::W16) - .addReg(AArch64::X17) - .addReg(AArch64::X16) - .addImm(0) - .addImm(0), - *STI); + EmitToStreamer(MCInstBuilder(AArch64::LDRBBroX) + .addReg(AArch64::W16) + .addReg(AArch64::X17) + .addReg(AArch64::X16) + .addImm(0) + .addImm(0)); } else { - OutStreamer->emitInstruction( - MCInstBuilder(AArch64::LDRBBroX) - .addReg(AArch64::W16) - .addReg(IsShort ? AArch64::X20 : AArch64::X9) - .addReg(AArch64::X16) - .addImm(0) - .addImm(0), - *STI); + EmitToStreamer(MCInstBuilder(AArch64::LDRBBroX) + .addReg(AArch64::W16) + .addReg(IsShort ? AArch64::X20 : AArch64::X9) + .addReg(AArch64::X16) + .addImm(0) + .addImm(0)); } -OutStreamer->emitInstruction( -MCInstBuilder(AArch64::SUBSXrs) -.addReg(AArch64::XZR) -.addReg(AArch64::X16) -.addReg(Reg) -.addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR, 56)), -*STI); +EmitToStreamer(MCInstBuilder(AArch64::SUBSXrs) + .addReg(AArch64::XZR) + .addReg(AArch64::X16) + .addReg(Reg) + .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSR, 56))); MCSymbol *HandleMismatchOrPartialSym = OutContext.createTempSymbol(); -OutStreamer->emitInstruction( -MCInstBuilder(AArch64::Bcc) -.addImm(AArch64CC::NE) -.addExpr(MCSymbolRefExpr::create(HandleMismatchOrPartialSym, - OutContext)), -*STI); +EmitToStreamer(MCInstBuilder(AArch64::Bcc) + .addImm(AArch64CC::NE) + .addExpr(MCSymbolRefExpr::create( + HandleMismatchOrPartialSym, OutContext))); MCSymbol *ReturnSym = OutContext.createTempSymbol(); OutStreamer->emitLabel(ReturnSym);
[llvm-branch-commits] [llvm] [AArch64] Generalize the instruction size checking in AsmPrinter (PR #110108)
https://github.com/atrosinenko created https://github.com/llvm/llvm-project/pull/110108 Most of PAuth-related code counts the instructions being inserted and asserts that no more bytes are emitted than the size returned by the getInstSizeInBytes(MI) method. This check seems useful not only for PAuth-related instructions. Also, reimplementing it globally in AArch64AsmPrinter makes it more robust and simplifies further refactoring of PAuth-related code. >From 4dfd901151b9ecde9e3795a6d4dba932d60859ee Mon Sep 17 00:00:00 2001 From: Anatoly Trosinenko Date: Wed, 25 Sep 2024 16:16:29 +0300 Subject: [PATCH] [AArch64] Generalize the instruction size checking in AsmPrinter Most of PAuth-related code counts the instructions being inserted and asserts that no more bytes are emitted than the size returned by the getInstSizeInBytes(MI) method. This check seems useful not only for PAuth-related instructions. Also, reimplementing it globally in AArch64AsmPrinter makes it more robust and simplifies further refactoring of PAuth-related code. --- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 121 +++--- llvm/lib/Target/AArch64/AArch64InstrInfo.td | 1 + 2 files changed, 44 insertions(+), 78 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 47dd32ad2adc2f..c6ee8d43bd8f2d 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -24,6 +24,7 @@ #include "MCTargetDesc/AArch64TargetStreamer.h" #include "TargetInfo/AArch64TargetInfo.h" #include "Utils/AArch64BaseInfo.h" +#include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -86,6 +87,9 @@ class AArch64AsmPrinter : public AsmPrinter { FaultMaps FM; const AArch64Subtarget *STI; bool ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags = false; +#ifndef NDEBUG + unsigned InstsEmitted; +#endif public: AArch64AsmPrinter(TargetMachine &TM, std::unique_ptr Streamer) @@ -150,8 +154,7 @@ class AArch64AsmPrinter : public AsmPrinter { void emitPtrauthAuthResign(const MachineInstr *MI); // Emit the sequence to compute a discriminator into x17, or reuse AddrDisc. - unsigned emitPtrauthDiscriminator(uint16_t Disc, unsigned AddrDisc, -unsigned &InstsEmitted); + unsigned emitPtrauthDiscriminator(uint16_t Disc, unsigned AddrDisc); // Emit the sequence for LOADauthptrstatic void LowerLOADauthptrstatic(const MachineInstr &MI); @@ -1338,8 +1341,6 @@ void AArch64AsmPrinter::LowerJumpTableDest(llvm::MCStreamer &OutStreamer, } void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { - unsigned InstsEmitted = 0; - const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); assert(MJTI && "Can't lower jump-table dispatch without JTI"); @@ -1377,10 +1378,8 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { .addReg(AArch64::X16) .addImm(MaxTableEntry) .addImm(0)); -++InstsEmitted; } else { emitMOVZ(AArch64::X17, static_cast(MaxTableEntry), 0); -++InstsEmitted; // It's sad that we have to manually materialize instructions, but we can't // trivially reuse the main pseudo expansion logic. // A MOVK sequence is easy enough to generate and handles the general case. @@ -1389,14 +1388,12 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { break; emitMOVK(AArch64::X17, static_cast(MaxTableEntry >> Offset), Offset); - ++InstsEmitted; } EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::SUBSXrs) .addReg(AArch64::XZR) .addReg(AArch64::X16) .addReg(AArch64::X17) .addImm(0)); -++InstsEmitted; } // This picks entry #0 on failure. @@ -1406,7 +1403,6 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { .addReg(AArch64::X16) .addReg(AArch64::XZR) .addImm(AArch64CC::LS)); - ++InstsEmitted; // Prepare the @PAGE/@PAGEOFF low/high operands. MachineOperand JTMOHi(JTOp), JTMOLo(JTOp); @@ -1421,14 +1417,12 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { EmitToStreamer( *OutStreamer, MCInstBuilder(AArch64::ADRP).addReg(AArch64::X17).addOperand(JTMCHi)); - ++InstsEmitted; EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::ADDXri) .addReg(AArch64::X17) .addReg(AArch64::X17) .addOperand
[llvm-branch-commits] [llvm] [AArch64] Generalize the instruction size checking in AsmPrinter (PR #110108)
llvmbot wrote: @llvm/pr-subscribers-backend-aarch64 Author: Anatoly Trosinenko (atrosinenko) Changes Most of PAuth-related code counts the instructions being inserted and asserts that no more bytes are emitted than the size returned by the getInstSizeInBytes(MI) method. This check seems useful not only for PAuth-related instructions. Also, reimplementing it globally in AArch64AsmPrinter makes it more robust and simplifies further refactoring of PAuth-related code. --- Full diff: https://github.com/llvm/llvm-project/pull/110108.diff 2 Files Affected: - (modified) llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp (+43-78) - (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.td (+1) ``diff diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 47dd32ad2adc2f..c6ee8d43bd8f2d 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -24,6 +24,7 @@ #include "MCTargetDesc/AArch64TargetStreamer.h" #include "TargetInfo/AArch64TargetInfo.h" #include "Utils/AArch64BaseInfo.h" +#include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -86,6 +87,9 @@ class AArch64AsmPrinter : public AsmPrinter { FaultMaps FM; const AArch64Subtarget *STI; bool ShouldEmitWeakSwiftAsyncExtendedFramePointerFlags = false; +#ifndef NDEBUG + unsigned InstsEmitted; +#endif public: AArch64AsmPrinter(TargetMachine &TM, std::unique_ptr Streamer) @@ -150,8 +154,7 @@ class AArch64AsmPrinter : public AsmPrinter { void emitPtrauthAuthResign(const MachineInstr *MI); // Emit the sequence to compute a discriminator into x17, or reuse AddrDisc. - unsigned emitPtrauthDiscriminator(uint16_t Disc, unsigned AddrDisc, -unsigned &InstsEmitted); + unsigned emitPtrauthDiscriminator(uint16_t Disc, unsigned AddrDisc); // Emit the sequence for LOADauthptrstatic void LowerLOADauthptrstatic(const MachineInstr &MI); @@ -1338,8 +1341,6 @@ void AArch64AsmPrinter::LowerJumpTableDest(llvm::MCStreamer &OutStreamer, } void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { - unsigned InstsEmitted = 0; - const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); assert(MJTI && "Can't lower jump-table dispatch without JTI"); @@ -1377,10 +1378,8 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { .addReg(AArch64::X16) .addImm(MaxTableEntry) .addImm(0)); -++InstsEmitted; } else { emitMOVZ(AArch64::X17, static_cast(MaxTableEntry), 0); -++InstsEmitted; // It's sad that we have to manually materialize instructions, but we can't // trivially reuse the main pseudo expansion logic. // A MOVK sequence is easy enough to generate and handles the general case. @@ -1389,14 +1388,12 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { break; emitMOVK(AArch64::X17, static_cast(MaxTableEntry >> Offset), Offset); - ++InstsEmitted; } EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::SUBSXrs) .addReg(AArch64::XZR) .addReg(AArch64::X16) .addReg(AArch64::X17) .addImm(0)); -++InstsEmitted; } // This picks entry #0 on failure. @@ -1406,7 +1403,6 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { .addReg(AArch64::X16) .addReg(AArch64::XZR) .addImm(AArch64CC::LS)); - ++InstsEmitted; // Prepare the @PAGE/@PAGEOFF low/high operands. MachineOperand JTMOHi(JTOp), JTMOLo(JTOp); @@ -1421,14 +1417,12 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { EmitToStreamer( *OutStreamer, MCInstBuilder(AArch64::ADRP).addReg(AArch64::X17).addOperand(JTMCHi)); - ++InstsEmitted; EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::ADDXri) .addReg(AArch64::X17) .addReg(AArch64::X17) .addOperand(JTMCLo) .addImm(0)); - ++InstsEmitted; EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::LDRSWroX) .addReg(AArch64::X16) @@ -1436,7 +1430,6 @@ void AArch64AsmPrinter::LowerHardenedBRJumpTable(const MachineInstr &MI) { .addReg(AArch64::X16) .addImm(0) .addImm(1)); - ++InstsEmitted; MCSymbol *AdrLabel = MF->getContext(
[llvm-branch-commits] [llvm] [AArch64] Consistently use EmitToStreamer across the AArch64AsmPrinter (PR #110107)
https://github.com/MaskRay approved this pull request. As you are adding a new function, it's good time to fix the naming case to `emitToStreamer` https://github.com/llvm/llvm-project/pull/110107 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
@@ -163,6 +163,43 @@ class AssociatedLoopChecker { std::map constructNamesAndLevels_; }; +bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) { + unsigned version{context_.langOptions().OpenMPVersion}; + DirectiveContext &dirCtx = GetContext(); + llvm::omp::Directive dir{dirCtx.directive}; + + if (!llvm::omp::isAllowedClauseForDirective(dir, clause, version)) { +unsigned allowedInVersion{[&] { + for (unsigned v : {45, 50, 51, 52, 60}) { +if (v <= version) { + continue; +} +if (llvm::omp::isAllowedClauseForDirective(dir, clause, v)) { + return v; +} + } + return 0u; +}()}; + +auto clauseName{parser::ToUpperCaseLetters(getClauseName(clause).str())}; +auto dirName{parser::ToUpperCaseLetters(getDirectiveName(dir).str())}; kparzysz wrote: Done https://github.com/llvm/llvm-project/pull/110015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][OpenMP] Add version checks for clauses (PR #110015)
https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/110015 >From 3c786ad2a50f146d357d882b0c1d966486f7295f Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 24 Sep 2024 17:41:16 -0500 Subject: [PATCH 1/5] [flang][OpenMP] Add version checks for clauses If there is a clause that is allowed on a given directive in a later version of the OpenMP spec, report an error and provide the minimal spec version that allows the clause. The case where a clause is not allowed on a directive at all is already handled elsewhere. --- flang/lib/Semantics/check-omp-structure.cpp | 93 +-- flang/lib/Semantics/check-omp-structure.h | 1 + flang/test/Lower/OpenMP/atomic-capture.f90| 4 +- flang/test/Lower/OpenMP/atomic-read.f90 | 2 +- flang/test/Lower/OpenMP/atomic-update.f90 | 4 +- flang/test/Lower/OpenMP/atomic-write.f90 | 2 +- .../test/Lower/OpenMP/declare-target-data.f90 | 4 +- .../declare-target-deferred-marking.f90 | 4 +- .../OpenMP/declare-target-func-and-subr.f90 | 4 +- ...arget-implicit-func-and-subr-cap-enter.f90 | 8 +- ...lare-target-implicit-func-and-subr-cap.f90 | 8 +- .../declare-target-implicit-tarop-cap.f90 | 8 +- .../Lower/OpenMP/function-filtering-2.f90 | 12 +-- .../test/Lower/OpenMP/function-filtering.f90 | 12 +-- .../OpenMP/declare_target-device_type.f90 | 4 +- .../Parser/OpenMP/in-reduction-clause.f90 | 4 +- flang/test/Parser/OpenMP/order-clause01.f90 | 4 +- flang/test/Parser/OpenMP/tile-size.f90| 4 +- flang/test/Parser/OpenMP/unroll-full.f90 | 4 +- flang/test/Parser/OpenMP/unroll.f90 | 4 +- .../Semantics/OpenMP/atomic-hint-clause.f90 | 2 +- flang/test/Semantics/OpenMP/atomic01.f90 | 2 +- flang/test/Semantics/OpenMP/atomic05.f90 | 2 +- .../Semantics/OpenMP/clause-validity01.f90| 2 +- .../OpenMP/declarative-directive.f90 | 2 +- .../Semantics/OpenMP/declare-target01.f90 | 2 +- .../Semantics/OpenMP/declare-target02.f90 | 2 +- .../Semantics/OpenMP/declare-target06.f90 | 2 +- .../Semantics/OpenMP/device-constructs.f90| 2 +- flang/test/Semantics/OpenMP/flush02.f90 | 2 +- flang/test/Semantics/OpenMP/if-clause.f90 | 2 +- flang/test/Semantics/OpenMP/nontemporal.f90 | 2 +- .../test/Semantics/OpenMP/order-clause01.f90 | 2 +- .../Semantics/OpenMP/requires-atomic01.f90| 2 +- .../Semantics/OpenMP/requires-atomic02.f90| 2 +- flang/test/Semantics/OpenMP/requires04.f90| 2 +- flang/test/Semantics/OpenMP/requires05.f90| 2 +- .../Semantics/OpenMP/simd-nontemporal.f90 | 2 +- flang/test/Semantics/OpenMP/target01.f90 | 2 +- flang/test/Semantics/OpenMP/taskgroup01.f90 | 2 +- .../test/Semantics/OpenMP/use_device_addr.f90 | 2 +- .../Semantics/OpenMP/use_device_addr1.f90 | 2 +- .../test/Semantics/OpenMP/use_device_ptr1.f90 | 2 +- 43 files changed, 137 insertions(+), 99 deletions(-) diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index dfc3f3290a81be..976c159e252f12 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -16,25 +16,25 @@ namespace Fortran::semantics { // Use when clause falls under 'struct OmpClause' in 'parse-tree.h'. #define CHECK_SIMPLE_CLAUSE(X, Y) \ void OmpStructureChecker::Enter(const parser::OmpClause::X &) { \ -CheckAllowed(llvm::omp::Clause::Y); \ +CheckAllowedClause(llvm::omp::Clause::Y); \ } #define CHECK_REQ_CONSTANT_SCALAR_INT_CLAUSE(X, Y) \ void OmpStructureChecker::Enter(const parser::OmpClause::X &c) { \ -CheckAllowed(llvm::omp::Clause::Y); \ +CheckAllowedClause(llvm::omp::Clause::Y); \ RequiresConstantPositiveParameter(llvm::omp::Clause::Y, c.v); \ } #define CHECK_REQ_SCALAR_INT_CLAUSE(X, Y) \ void OmpStructureChecker::Enter(const parser::OmpClause::X &c) { \ -CheckAllowed(llvm::omp::Clause::Y); \ +CheckAllowedClause(llvm::omp::Clause::Y); \ RequiresPositiveParameter(llvm::omp::Clause::Y, c.v); \ } // Use when clause don't falls under 'struct OmpClause' in 'parse-tree.h'. #define CHECK_SIMPLE_PARSER_CLAUSE(X, Y) \ void OmpStructureChecker::Enter(const parser::X &) { \ -CheckAllowed(llvm::omp::Y); \ +CheckAllowedClause(llvm::omp::Y); \ } // 'OmpWorkshareBlockChecker' is used to check the validity of the assignment @@ -163,6 +163,43 @@ class AssociatedLoopChecker { std::map constructNamesAndLevels_; }; +bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) { + unsigned version{context_.langOptions().OpenMPVersion}; + DirectiveContext &dirCtx = GetContext(); + llvm::omp::Directive dir{dirCtx.directive}; + + if (!llvm::omp::isAllowedClauseForDirective(dir, clause, version)) { +unsigned allowedInVersion{[&] { + for (unsigned v : {45, 50, 51, 52, 60}) { +if (v <= version) { + c
[llvm-branch-commits] [llvm] [AArch64] Generalize the instruction size checking in AsmPrinter (PR #110108)
https://github.com/kovdan01 commented: LGTM, but please wait for other reviews https://github.com/llvm/llvm-project/pull/110108 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [flang][Semantics] Add LangOptions to SemanticsContext (PR #110013)
https://github.com/tblah approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/110013 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] 61e03b6 - Revert "[mlir][tensor] Refine the semantics of `createPadHighOp` (#109667)"
Author: Han-Chung Wang Date: 2024-09-26T11:17:47-07:00 New Revision: 61e03b68511862ace5bc361565b2535e27fde833 URL: https://github.com/llvm/llvm-project/commit/61e03b68511862ace5bc361565b2535e27fde833 DIFF: https://github.com/llvm/llvm-project/commit/61e03b68511862ace5bc361565b2535e27fde833.diff LOG: Revert "[mlir][tensor] Refine the semantics of `createPadHighOp` (#109667)" This reverts commit 9c48a04328f1dfa739985f64b33f20b67e085277. Added: Modified: mlir/include/mlir/Dialect/Tensor/Utils/Utils.h mlir/lib/Dialect/Tensor/Utils/Utils.cpp Removed: diff --git a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h index e63749eb384316..84d06d456bb689 100644 --- a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h +++ b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h @@ -14,10 +14,10 @@ namespace mlir { namespace tensor { -// Return a PadOp that pads `source` to `type` size. Output sizes (from `type`) -// are assumed to be static and greater than the potentially dynamic input sizes -// (from `source). The op performs "high" padding (i.e. it adds trailing padding -// values until the desired size is met). +// Return a PadOp that pads `source` to `type` size where the static +// sizes are assumed to be greater than the dynamic sizes. If `type` has dynamic +// dimensions the padding width is set to zero. The op performs "high" padding +// (i.e. it adds trailing padding values until the desired size is met). PadOp createPadHighOp(RankedTensorType type, Value source, Value pad, bool nofold, Location loc, OpBuilder &builder); diff --git a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp index 0cb16c28b829c2..a0d8a08fc6ba47 100644 --- a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp @@ -24,17 +24,12 @@ using namespace mlir::tensor; PadOp mlir::tensor::createPadHighOp(RankedTensorType type, Value source, Value pad, bool nofold, Location loc, OpBuilder &b) { - - // TODO: Either relax or turn this into a failure - assert(!ShapedType::isDynamicShape(type.getShape()) && - "The output type is dynamic - that's not supported ATM."); - - // Init "low" and "high" padding values ("low" is kept as is, "high" is - // computed below). SmallVector low(type.getRank(), b.getIndexAttr(0)); SmallVector high(type.getRank(), b.getIndexAttr(0)); - for (const auto &en : enumerate(type.getShape())) { +// Pad only the static dimensions of the result tensor type. +if (ShapedType::isDynamic(en.value())) + continue; // Compute the padding width. AffineExpr d0; bindDims(b.getContext(), d0); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
@@ -722,6 +770,15 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) { } } + if (opts::StaleMatchingWithPseudoProbes) { +const MCPseudoProbeDecoder *Decoder = BC.getPseudoProbeDecoder(); +assert(Decoder && + "If pseudo probes are in use, pseudo probe decoder should exist"); +for (const MCDecodedPseudoProbeInlineTree &TopLev : + Decoder->getDummyInlineRoot().getChildren()) + TopLevelGUIDToInlineTree[TopLev.Guid] = &TopLev; + } + aaupov wrote: We want to set TopLevelGUID... once though, that's why I decided to keep it in top-level location. matchWeightsByHashes would be invoked for every profile basic block. https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all function probes at once Drop ProfileUsePseudoProbes Unify matchWithBlockPseudoProbes Distinguish exact and loose probe match --- bolt/include/bolt/Core/BinaryContext.h| 20 +- bolt/lib/Passes/BinaryPasses.cpp | 40 ++- bolt/lib/Profile/StaleProfileMatching.cpp | 404 ++ bolt/lib/Rewrite/PseudoProbeRewriter.cpp | 8 +- 4 files changed, 237 insertions(+), 235 deletions(-) diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h index 3e20cb607e657b..3f7b2ac0bc6cf9 100644 --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -724,14 +724,26 @@ class BinaryContext { uint32_t NumStaleBlocks{0}; /// the number of exactly matched basic blocks uint32_t NumExactMatchedBlocks{0}; -/// the number of pseudo probe matched basic blocks -uint32_t NumPseudoProbeMatchedBlocks{0}; +/// the number of loosely matched basic blocks +uint32_t NumLooseMatchedBlocks{0}; +/// the number of exactly pseudo probe matched basic blocks +uint32_t NumPseudoProbeExactMatchedBlocks{0}; +/// the number of loosely pseudo probe matched basic blocks +uint32_t NumPseudoProbeLooseMatchedBlocks{0}; +/// the number of call matched basic blocks +uint32_t NumCallMatchedBlocks{0}; /// the total count of samples in the profile uint64_t StaleSampleCount{0}; /// the count of exactly matched samples uint64_t ExactMatchedSampleCount{0}; -/// the count of pseudo probe matched samples -uint64_t PseudoProbeMatchedSampleCount{0}; +/// the count of exactly matched samples +uint64_t LooseMatchedSampleCount{0}; +/// the count of exactly pseudo probe matched samples +uint64_t PseudoProbeExactMatchedSampleCount{0}; +/// the count of loosely pseudo probe matched samples +uint64_t PseudoProbeLooseMatchedSampleCount{0}; +/// the count of call matched samples +uint64_t CallMatchedSampleCount{0}; /// the number of stale functions that have matching number of blocks in /// the profile uint64_t NumStaleFuncsWithEqualBlockCount{0}; diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp index b786f07a6a6651..8edbd58c3ed3de 100644 --- a/bolt/lib/Passes/BinaryPasses.cpp +++ b/bolt/lib/Passes/BinaryPasses.cpp @@ -1524,15 +1524,43 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) { 100.0 * BC.Stats.ExactMatchedSampleCount / BC.Stats.StaleSampleCount, BC.Stats.ExactMatchedSampleCount, BC.Stats.StaleSampleCount); BC.outs() << format( -"BOLT-INFO: inference found a pseudo probe match for %.2f%% of basic " +"BOLT-INFO: inference found an exact pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeExactMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeExactMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeExactMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeExactMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a loose pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeLooseMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeLooseMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeLooseMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeLooseMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a call match for %.2f%% of basic " "blocks" " (%zu out of %zu stale) responsible for %.2f%% samples" " (%zu out of %zu stale)\n", -100.0 * BC.Stats.NumPseudoProbeMatchedBlocks / BC.Stats.NumStaleBlocks, -BC.Stats.NumPseudoProbeMatchedBlocks, BC.Stats.NumStaleBlocks, -100.0 * BC.Stats.PseudoProbeMatchedSampleCount / -BC.Stats.StaleSampleCount, -BC.Stats.PseudoProbeMatchedSampleCount, BC.Stats.StaleSampleCount); +100.0 * BC.Stats.NumCallMatchedBlocks / BC.Stats.NumStaleBlocks, +BC.Stats.NumCallMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.CallMatchedSampleCount / BC.Stats.StaleSampleCount, +BC.Stats.CallMatchedSampleCount, BC.Stats.StaleSampleCount); +BC
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] AtomicExpand: Copy metadata from atomicrmw to cmpxchg (PR #109409)
efriedma-quic wrote: > (which for some reason is not emitted as an atomic). In terms of the generated code, I think we're fine; we don't rely on the load producing a value that's consistent with atomic ordering, I think. That said, it probably should be atomic, because strictly speaking a race is UB if we use a non-atomic load. https://github.com/llvm/llvm-project/pull/109409 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] AMDGPU: Custom expand flat cmpxchg which may access private (PR #109410)
@@ -25,20 +25,29 @@ bool llvm::lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI) { Value *Cmp = CXI->getCompareOperand(); Value *Val = CXI->getNewValOperand(); - LoadInst *Orig = - Builder.CreateAlignedLoad(Val->getType(), Ptr, CXI->getAlign()); - Value *Equal = Builder.CreateICmpEQ(Orig, Cmp); - Value *Res = Builder.CreateSelect(Equal, Val, Orig); - Builder.CreateAlignedStore(Res, Ptr, CXI->getAlign()); + auto [Orig, Equal] = + buildAtomicCmpXchgValue(Builder, Ptr, Cmp, Val, CXI->getAlign()); - Res = Builder.CreateInsertValue(PoisonValue::get(CXI->getType()), Orig, 0); + Value *Res = + Builder.CreateInsertValue(PoisonValue::get(CXI->getType()), Orig, 0); Res = Builder.CreateInsertValue(Res, Equal, 1); CXI->replaceAllUsesWith(Res); CXI->eraseFromParent(); return true; } +std::pair +llvm::buildAtomicCmpXchgValue(IRBuilderBase &Builder, Value *Ptr, Value *Cmp, efriedma-quic wrote: Putting "atomic" in the name here is a little strange; this isn't atomic. https://github.com/llvm/llvm-project/pull/109410 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all function probes at once Drop ProfileUsePseudoProbes Unify matchWithBlockPseudoProbes Distinguish exact and loose probe match --- bolt/include/bolt/Core/BinaryContext.h| 20 +- bolt/lib/Passes/BinaryPasses.cpp | 40 ++- bolt/lib/Profile/StaleProfileMatching.cpp | 404 ++ bolt/lib/Rewrite/PseudoProbeRewriter.cpp | 8 +- 4 files changed, 237 insertions(+), 235 deletions(-) diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h index 3e20cb607e657b..3f7b2ac0bc6cf9 100644 --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -724,14 +724,26 @@ class BinaryContext { uint32_t NumStaleBlocks{0}; /// the number of exactly matched basic blocks uint32_t NumExactMatchedBlocks{0}; -/// the number of pseudo probe matched basic blocks -uint32_t NumPseudoProbeMatchedBlocks{0}; +/// the number of loosely matched basic blocks +uint32_t NumLooseMatchedBlocks{0}; +/// the number of exactly pseudo probe matched basic blocks +uint32_t NumPseudoProbeExactMatchedBlocks{0}; +/// the number of loosely pseudo probe matched basic blocks +uint32_t NumPseudoProbeLooseMatchedBlocks{0}; +/// the number of call matched basic blocks +uint32_t NumCallMatchedBlocks{0}; /// the total count of samples in the profile uint64_t StaleSampleCount{0}; /// the count of exactly matched samples uint64_t ExactMatchedSampleCount{0}; -/// the count of pseudo probe matched samples -uint64_t PseudoProbeMatchedSampleCount{0}; +/// the count of exactly matched samples +uint64_t LooseMatchedSampleCount{0}; +/// the count of exactly pseudo probe matched samples +uint64_t PseudoProbeExactMatchedSampleCount{0}; +/// the count of loosely pseudo probe matched samples +uint64_t PseudoProbeLooseMatchedSampleCount{0}; +/// the count of call matched samples +uint64_t CallMatchedSampleCount{0}; /// the number of stale functions that have matching number of blocks in /// the profile uint64_t NumStaleFuncsWithEqualBlockCount{0}; diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp index b786f07a6a6651..8edbd58c3ed3de 100644 --- a/bolt/lib/Passes/BinaryPasses.cpp +++ b/bolt/lib/Passes/BinaryPasses.cpp @@ -1524,15 +1524,43 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) { 100.0 * BC.Stats.ExactMatchedSampleCount / BC.Stats.StaleSampleCount, BC.Stats.ExactMatchedSampleCount, BC.Stats.StaleSampleCount); BC.outs() << format( -"BOLT-INFO: inference found a pseudo probe match for %.2f%% of basic " +"BOLT-INFO: inference found an exact pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeExactMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeExactMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeExactMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeExactMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a loose pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeLooseMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeLooseMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeLooseMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeLooseMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a call match for %.2f%% of basic " "blocks" " (%zu out of %zu stale) responsible for %.2f%% samples" " (%zu out of %zu stale)\n", -100.0 * BC.Stats.NumPseudoProbeMatchedBlocks / BC.Stats.NumStaleBlocks, -BC.Stats.NumPseudoProbeMatchedBlocks, BC.Stats.NumStaleBlocks, -100.0 * BC.Stats.PseudoProbeMatchedSampleCount / -BC.Stats.StaleSampleCount, -BC.Stats.PseudoProbeMatchedSampleCount, BC.Stats.StaleSampleCount); +100.0 * BC.Stats.NumCallMatchedBlocks / BC.Stats.NumStaleBlocks, +BC.Stats.NumCallMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.CallMatchedSampleCount / BC.Stats.StaleSampleCount, +BC.Stats.CallMatchedSampleCount, BC.Stats.StaleSampleCount); +BC
[llvm-branch-commits] [llvm] AtomicExpand: Copy metadata from atomicrmw to cmpxchg (PR #109409)
https://github.com/efriedma-quic commented: I'm not sure we can assume all metadata which applies to an atomicrmw also makes sense on the generated cmpxchg. I mean, most metadata probably does, but say we start allowing `!align` metadata on atomicrmw... https://github.com/llvm/llvm-project/pull/109409 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
@@ -0,0 +1,62 @@ +## Tests stale block matching with pseudo probes. + +# REQUIRES: system-linux +# RUN: split-file %s %t +# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib +# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml -v=2 \ +# RUN: --print-cfg --funcs=main --profile-ignore-hash=0 --infer-stale-profile --profile-use-pseudo-probes --stale-matching-with-block-pseudo-probes 2>&1 | FileCheck %s + +# CHECK: BOLT-INFO: inference found a pseudo probe match for 100.00% of basic blocks (1 out of 1 stale) responsible for -nan% samples (0 out of 0 stale) + +#--- main.s + .text + .globl main# -- Begin function main + .p2align4, 0x90 + .type main,@function +main: # @main +# %bb.0: + pushq %rbp + movq%rsp, %rbp + movl$0, -4(%rbp) + .pseudoprobe15822663052811949562 1 0 0 main aaupov wrote: bolt/test/X86/match-blocks-with-pseudo-probes-inline.test has simple inline tree matching. https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all function probes at once Drop ProfileUsePseudoProbes Unify matchWithBlockPseudoProbes Distinguish exact and loose probe match --- bolt/include/bolt/Core/BinaryContext.h| 20 +- bolt/lib/Passes/BinaryPasses.cpp | 40 ++- bolt/lib/Profile/StaleProfileMatching.cpp | 404 ++ bolt/lib/Rewrite/PseudoProbeRewriter.cpp | 8 +- 4 files changed, 237 insertions(+), 235 deletions(-) diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h index 3e20cb607e657b..3f7b2ac0bc6cf9 100644 --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -724,14 +724,26 @@ class BinaryContext { uint32_t NumStaleBlocks{0}; /// the number of exactly matched basic blocks uint32_t NumExactMatchedBlocks{0}; -/// the number of pseudo probe matched basic blocks -uint32_t NumPseudoProbeMatchedBlocks{0}; +/// the number of loosely matched basic blocks +uint32_t NumLooseMatchedBlocks{0}; +/// the number of exactly pseudo probe matched basic blocks +uint32_t NumPseudoProbeExactMatchedBlocks{0}; +/// the number of loosely pseudo probe matched basic blocks +uint32_t NumPseudoProbeLooseMatchedBlocks{0}; +/// the number of call matched basic blocks +uint32_t NumCallMatchedBlocks{0}; /// the total count of samples in the profile uint64_t StaleSampleCount{0}; /// the count of exactly matched samples uint64_t ExactMatchedSampleCount{0}; -/// the count of pseudo probe matched samples -uint64_t PseudoProbeMatchedSampleCount{0}; +/// the count of exactly matched samples +uint64_t LooseMatchedSampleCount{0}; +/// the count of exactly pseudo probe matched samples +uint64_t PseudoProbeExactMatchedSampleCount{0}; +/// the count of loosely pseudo probe matched samples +uint64_t PseudoProbeLooseMatchedSampleCount{0}; +/// the count of call matched samples +uint64_t CallMatchedSampleCount{0}; /// the number of stale functions that have matching number of blocks in /// the profile uint64_t NumStaleFuncsWithEqualBlockCount{0}; diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp index b786f07a6a6651..8edbd58c3ed3de 100644 --- a/bolt/lib/Passes/BinaryPasses.cpp +++ b/bolt/lib/Passes/BinaryPasses.cpp @@ -1524,15 +1524,43 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) { 100.0 * BC.Stats.ExactMatchedSampleCount / BC.Stats.StaleSampleCount, BC.Stats.ExactMatchedSampleCount, BC.Stats.StaleSampleCount); BC.outs() << format( -"BOLT-INFO: inference found a pseudo probe match for %.2f%% of basic " +"BOLT-INFO: inference found an exact pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeExactMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeExactMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeExactMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeExactMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a loose pseudo probe match for %.2f%% of " +"basic blocks (%zu out of %zu stale) responsible for %.2f%% samples" +" (%zu out of %zu stale)\n", +100.0 * BC.Stats.NumPseudoProbeLooseMatchedBlocks / +BC.Stats.NumStaleBlocks, +BC.Stats.NumPseudoProbeLooseMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.PseudoProbeLooseMatchedSampleCount / +BC.Stats.StaleSampleCount, +BC.Stats.PseudoProbeLooseMatchedSampleCount, BC.Stats.StaleSampleCount); +BC.outs() << format( +"BOLT-INFO: inference found a call match for %.2f%% of basic " "blocks" " (%zu out of %zu stale) responsible for %.2f%% samples" " (%zu out of %zu stale)\n", -100.0 * BC.Stats.NumPseudoProbeMatchedBlocks / BC.Stats.NumStaleBlocks, -BC.Stats.NumPseudoProbeMatchedBlocks, BC.Stats.NumStaleBlocks, -100.0 * BC.Stats.PseudoProbeMatchedSampleCount / -BC.Stats.StaleSampleCount, -BC.Stats.PseudoProbeMatchedSampleCount, BC.Stats.StaleSampleCount); +100.0 * BC.Stats.NumCallMatchedBlocks / BC.Stats.NumStaleBlocks, +BC.Stats.NumCallMatchedBlocks, BC.Stats.NumStaleBlocks, +100.0 * BC.Stats.CallMatchedSampleCount / BC.Stats.StaleSampleCount, +BC.Stats.CallMatchedSampleCount, BC.Stats.StaleSampleCount); +BC
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
https://github.com/ldionne milestoned https://github.com/llvm/llvm-project/pull/110162 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
ldionne wrote: @tru At this point, the important CI has passed. Please consider merging this so I can rebase the other libc++ PRs on top of it, get the CI to run and clear the backlog for the 19 milestone PRs. https://github.com/llvm/llvm-project/pull/110162 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AMDGPU] Adopt new lowering sequence for `fdiv16` (PR #109295)
https://github.com/shiltian edited https://github.com/llvm/llvm-project/pull/109295 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) Changes The CI has been a complete mess for the past week, and the only thing preventing it from being back is the Clang tidy checks. Disable them (as a total hack) to get CI back. (cherry picked from commit 78c6506543dee13c9335edc5c85bc73c4853fbd7) --- Full diff: https://github.com/llvm/llvm-project/pull/110162.diff 1 Files Affected: - (modified) libcxx/test/tools/clang_tidy_checks/CMakeLists.txt (+2) ``diff diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt index f0289dc44c6625..125b2184a49ea6 100644 --- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt +++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt @@ -1,3 +1,5 @@ +# TODO: Re-enable the tests once the CI is back under control +return() # The find_package changes these variables. This leaves the build in an odd # state. Calling cmake a second time tries to write site config information in `` https://github.com/llvm/llvm-project/pull/110162 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64] Consistently use EmitToStreamer across the AArch64AsmPrinter (PR #110107)
atrosinenko wrote: Thank you for the review! > As you are adding a new function, it's good time to fix the naming case to > `emitToStreamer` I think renaming `EmitToStreamer` to `emitToStreamer` now may be a bit error-prone, as this function overrides the non-virtual `AsmPrinter::EmitToStreamer`, so in `AArch64AsmParser` there would be two different functions accessible with almost identical names and almost identical implementations. https://github.com/llvm/llvm-project/pull/110107 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/19.x: [loongarch][DAG][FREEZE] Fix crash when FREEZE a half(f16) type on loongarch (#107791) (PR #109093)
tgross35 wrote: > Currently, Rust's compiler-builtins has marked fp16 as available for > loongarch64, but in fact, the functionality is broken. Even with this patch, > it is not optimal. Subjectively, I hope these patches can be backported to > LLVM 19 to avoid ABI incompatibility issues across multiple versions. If we > don’t break anything unrelated to fp16, it won’t be a bad thing to work on > fixing fp16, as it was already broken to begin with. Thanks. If you are referring to https://github.com/rust-lang/compiler-builtins/blob/bb18ce58c2b5fec081a5dd3553aa960a36b8de5c/configure.rs#L51-L91, we only disable f16/f128 on platforms where LLVM 19 actually has a crash or produces code that can't be linked. Quite a few of the targets that aren't disabled there have some form of ABI issue - so we just build the symbols but don't actually test with them. (the config for what gets tested is at https://github.com/rust-lang/rust/blob/2bd1e894efde3b6be857ad345914a3b1cea51def/library/std/build.rs#L81-L186) https://github.com/llvm/llvm-project/pull/109093 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 4b2d897 - Revert "[SandboxIR][NFC] Move Region from SandboxVectorizer to SandboxIR. (#1…"
Author: Jorge Gorbe Moya Date: 2024-09-26T14:55:52-07:00 New Revision: 4b2d897e9dcacf206ccd2b2326621a25d11727e5 URL: https://github.com/llvm/llvm-project/commit/4b2d897e9dcacf206ccd2b2326621a25d11727e5 DIFF: https://github.com/llvm/llvm-project/commit/4b2d897e9dcacf206ccd2b2326621a25d11727e5.diff LOG: Revert "[SandboxIR][NFC] Move Region from SandboxVectorizer to SandboxIR. (#1…" This reverts commit 3d9ed92630fb2a3282ba4a49b43d6eccca2f3509. Added: llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Region.h llvm/lib/Transforms/Vectorize/SandboxVectorizer/Region.cpp llvm/unittests/Transforms/Vectorize/SandboxVectorizer/RegionTest.cpp Modified: llvm/lib/SandboxIR/CMakeLists.txt llvm/lib/Transforms/Vectorize/CMakeLists.txt llvm/unittests/SandboxIR/CMakeLists.txt llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt Removed: llvm/include/llvm/SandboxIR/Region.h llvm/lib/SandboxIR/Region.cpp llvm/unittests/SandboxIR/RegionTest.cpp diff --git a/llvm/include/llvm/SandboxIR/Region.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Region.h similarity index 100% rename from llvm/include/llvm/SandboxIR/Region.h rename to llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Region.h diff --git a/llvm/lib/SandboxIR/CMakeLists.txt b/llvm/lib/SandboxIR/CMakeLists.txt index a1295d67bc54f7..6386fc908388a0 100644 --- a/llvm/lib/SandboxIR/CMakeLists.txt +++ b/llvm/lib/SandboxIR/CMakeLists.txt @@ -3,7 +3,6 @@ add_llvm_component_library(LLVMSandboxIR Module.cpp Pass.cpp PassManager.cpp - Region.cpp SandboxIR.cpp Tracker.cpp Type.cpp diff --git a/llvm/lib/Transforms/Vectorize/CMakeLists.txt b/llvm/lib/Transforms/Vectorize/CMakeLists.txt index eeff4a9f6a8bae..8bd3dbf0695733 100644 --- a/llvm/lib/Transforms/Vectorize/CMakeLists.txt +++ b/llvm/lib/Transforms/Vectorize/CMakeLists.txt @@ -5,6 +5,7 @@ add_llvm_component_library(LLVMVectorize LoopVectorize.cpp SandboxVectorizer/DependencyGraph.cpp SandboxVectorizer/Passes/BottomUpVec.cpp + SandboxVectorizer/Region.cpp SandboxVectorizer/SandboxVectorizer.cpp SLPVectorizer.cpp Vectorize.cpp diff --git a/llvm/lib/SandboxIR/Region.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Region.cpp similarity index 96% rename from llvm/lib/SandboxIR/Region.cpp rename to llvm/lib/Transforms/Vectorize/SandboxVectorizer/Region.cpp index b14c87f44260f9..5f2c28484f62bc 100644 --- a/llvm/lib/SandboxIR/Region.cpp +++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Region.cpp @@ -6,7 +6,7 @@ // //===--===// -#include "llvm/SandboxIR/Region.h" +#include "llvm/Transforms/Vectorize/SandboxVectorizer/Region.h" namespace llvm::sandboxir { diff --git a/llvm/unittests/SandboxIR/CMakeLists.txt b/llvm/unittests/SandboxIR/CMakeLists.txt index 622496ada567fc..2ab284a511fcaa 100644 --- a/llvm/unittests/SandboxIR/CMakeLists.txt +++ b/llvm/unittests/SandboxIR/CMakeLists.txt @@ -7,7 +7,6 @@ set(LLVM_LINK_COMPONENTS add_llvm_unittest(SandboxIRTests PassTest.cpp - RegionTest.cpp SandboxIRTest.cpp TrackerTest.cpp TypesTest.cpp diff --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt index b0ef71ba2114a1..86b1d968094cab 100644 --- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt +++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/CMakeLists.txt @@ -11,4 +11,5 @@ add_llvm_unittest(SandboxVectorizerTests DependencyGraphTest.cpp InstrIntervalTest.cpp LegalityTest.cpp + RegionTest.cpp ) diff --git a/llvm/unittests/SandboxIR/RegionTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/RegionTest.cpp similarity index 100% rename from llvm/unittests/SandboxIR/RegionTest.cpp rename to llvm/unittests/Transforms/Vectorize/SandboxVectorizer/RegionTest.cpp ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
ldionne wrote: @tru This patch should make the libc++ CI pass again. Unfortunately, it looks like we're going to have to let the clang-tidy checks go for now. Once this passes CI (🤞), we can merge this, and then I can rebase #110161, #109324, #109291, #109054 and #106077 which should all pass. https://github.com/llvm/llvm-project/pull/110162 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/110162 The CI has been a complete mess for the past week, and the only thing preventing it from being back is the Clang tidy checks. Disable them (as a total hack) to get CI back. (cherry picked from commit 78c6506543dee13c9335edc5c85bc73c4853fbd7) >From 8a25c601eb64bcdb7c6c74bee52655468dfdd91b Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Wed, 25 Sep 2024 12:40:14 -0400 Subject: [PATCH] [libc++] Disable the clang-tidy checks to get CI back (#109989) The CI has been a complete mess for the past week, and the only thing preventing it from being back is the Clang tidy checks. Disable them (as a total hack) to get CI back. (cherry picked from commit 78c6506543dee13c9335edc5c85bc73c4853fbd7) --- libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt index f0289dc44c6625..125b2184a49ea6 100644 --- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt +++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt @@ -1,3 +1,5 @@ +# TODO: Re-enable the tests once the CI is back under control +return() # The find_package changes these variables. This leaves the build in an odd # state. Calling cmake a second time tries to write site config information in ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [libc++] Disable the clang-tidy checks to get CI back (#109989) (PR #110162)
https://github.com/ldionne edited https://github.com/llvm/llvm-project/pull/110162 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] d5ee252 - Revert "[HLSL] Vector Usual Arithmetic Conversions (#108659)"
Author: Chris B Date: 2024-09-26T19:34:17-05:00 New Revision: d5ee252c6bddcd27210e3a031cef8065679c8da5 URL: https://github.com/llvm/llvm-project/commit/d5ee252c6bddcd27210e3a031cef8065679c8da5 DIFF: https://github.com/llvm/llvm-project/commit/d5ee252c6bddcd27210e3a031cef8065679c8da5.diff LOG: Revert "[HLSL] Vector Usual Arithmetic Conversions (#108659)" This reverts commit e82b26a3d388594a8af5640cd8aa570f7ecda469. Added: Modified: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/include/clang/Driver/Options.td clang/include/clang/Sema/Sema.h clang/include/clang/Sema/SemaHLSL.h clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaHLSL.cpp Removed: clang/test/SemaHLSL/Language/UsualArithmeticConversions.hlsl diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 9e8f152852fd1e..f3d5d4c56606cc 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -12395,9 +12395,6 @@ def err_hlsl_operator_unsupported : Error< def err_hlsl_param_qualifier_mismatch : Error<"conflicting parameter qualifier %0 on parameter %1">; -def err_hlsl_vector_compound_assignment_truncation : Error< - "left hand operand of type %0 to compound assignment cannot be truncated " - "when used with right hand operand of type %1">; def warn_hlsl_impcast_vector_truncation : Warning< "implicit conversion truncates vector: %0 to %1">, InGroup; diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1dc2ff18170abf..932cf13edab53d 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2978,7 +2978,7 @@ def flax_vector_conversions_EQ : Joined<["-"], "flax-vector-conversions=">, Grou "LangOptions::LaxVectorConversionKind::Integer", "LangOptions::LaxVectorConversionKind::All"]>, MarshallingInfoEnum, - !strconcat("(", open_cl.KeyPath, " || ", hlsl.KeyPath, ")") # + open_cl.KeyPath # " ? LangOptions::LaxVectorConversionKind::None" # " : LangOptions::LaxVectorConversionKind::All">; def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group, diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index a9ce3681338d46..e1c3a99cfa167e 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -7423,8 +7423,7 @@ class Sema final : public SemaBase { SourceLocation Loc, BinaryOperatorKind Opc); QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, - SourceLocation Loc, - BinaryOperatorKind Opc); + SourceLocation Loc); /// Context in which we're performing a usual arithmetic conversion. enum ArithConvKind { diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h index fa957abc9791af..311cd58bbcac2c 100644 --- a/clang/include/clang/Sema/SemaHLSL.h +++ b/clang/include/clang/Sema/SemaHLSL.h @@ -63,11 +63,6 @@ class SemaHLSL : public SemaBase { std::initializer_list AllowedStages); void DiagnoseAvailabilityViolations(TranslationUnitDecl *TU); - QualType handleVectorBinOpConversion(ExprResult &LHS, ExprResult &RHS, - QualType LHSType, QualType RHSType, - bool IsCompAssign); - void emitLogicalOperatorFixIt(Expr *LHS, Expr *RHS, BinaryOperatorKind Opc); - void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL); void handleWaveSizeAttr(Decl *D, const ParsedAttr &AL); void handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index e072fb65b81328..66df9c969256a2 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -10133,10 +10133,6 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, const VectorType *RHSVecType = RHSType->getAs(); assert(LHSVecType || RHSVecType); - if (getLangOpts().HLSL) -return HLSL().handleVectorBinOpConversion(LHS, RHS, LHSType, RHSType, - IsCompAssign); - // AltiVec-style "vector bool op vector bool" combinations are allowed // for some operators but not others. if (!AllowBothBool && LHSVecType && @@ -12867,8 +12863,7 @@ static void diagnoseXorMisusedAsPow(Sema &S, const ExprResult &XorLHS, } QualType Sema::CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, - SourceLocation Loc, -