Skip to content

Commit e17003f

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-remove-loop-region-instead-of-using-branch-on-cond-true
2 parents df67f2e + 20d491b commit e17003f

File tree

68 files changed

+3929
-1074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3929
-1074
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling",
18901890
" pseudo probes for sample profiling">>;
18911891
def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">,
18921892
Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
1893-
HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
1893+
HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var). Deprecated, please use temporal profiling.">;
18941894
def fprofile_list_EQ : Joined<["-"], "fprofile-list=">,
18951895
Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
18961896
HelpText<"Filename defining the list of functions/files to instrument. "

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8010,15 +8010,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
80108010
}
80118011
}
80128012

8013-
if (Args.hasArg(options::OPT_forder_file_instrumentation)) {
8014-
CmdArgs.push_back("-forder-file-instrumentation");
8015-
// Enable order file instrumentation when ThinLTO is not on. When ThinLTO is
8016-
// on, we need to pass these flags as linker flags and that will be handled
8017-
// outside of the compiler.
8018-
if (!IsUsingLTO) {
8019-
CmdArgs.push_back("-mllvm");
8020-
CmdArgs.push_back("-enable-order-file-instrumentation");
8021-
}
8013+
if (const Arg *A =
8014+
Args.getLastArg(options::OPT_forder_file_instrumentation)) {
8015+
D.Diag(diag::warn_drv_deprecated_arg)
8016+
<< A->getAsString(Args) << /*hasReplacement=*/true
8017+
<< "-mllvm -pgo-temporal-instrumentation";
8018+
CmdArgs.push_back("-forder-file-instrumentation");
8019+
// Enable order file instrumentation when ThinLTO is not on. When ThinLTO is
8020+
// on, we need to pass these flags as linker flags and that will be handled
8021+
// outside of the compiler.
8022+
if (!IsUsingLTO) {
8023+
CmdArgs.push_back("-mllvm");
8024+
CmdArgs.push_back("-enable-order-file-instrumentation");
8025+
}
80228026
}
80238027

80248028
if (Arg *A = Args.getLastArg(options::OPT_fforce_enable_int128,

clang/test/Driver/clang_f_opts.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@
364364
// RUN: -fno-devirtualize-speculatively \
365365
// RUN: -fslp-vectorize-aggressive \
366366
// RUN: -fno-slp-vectorize-aggressive \
367+
// RUN: -forder-file-instrumentation \
367368
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
368369
// CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
369370
// CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
@@ -423,6 +424,7 @@
423424
// CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported
424425
// CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been deprecated and will be ignored
425426
// CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been deprecated and will be ignored
427+
// CHECK-WARNING-DAG: argument '-forder-file-instrumentation' is deprecated, use '-mllvm -pgo-temporal-instrumentation' instead
426428

427429
// Test that we mute the warning on these
428430
// RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument \

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
121121
// constant attribute of [hl]fir.declare/fircg.ext_declare operation that has
122122
// a dummy_scope operand).
123123
unsigned argNo = 0;
124-
if (fir::isDummyArgument(declOp.getMemref())) {
125-
auto arg = llvm::cast<mlir::BlockArgument>(declOp.getMemref());
126-
argNo = arg.getArgNumber() + 1;
124+
if (declOp.getDummyScope()) {
125+
if (auto arg = llvm::dyn_cast<mlir::BlockArgument>(declOp.getMemref()))
126+
argNo = arg.getArgNumber() + 1;
127127
}
128128

129129
auto tyAttr = typeGen.convertType(fir::unwrapRefType(declOp.getType()),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
! RUN: %flang_fc1 -fopenmp -emit-llvm -debug-info-kind=standalone %s -o -
2+
3+
! Test that this does not cause build failure.
4+
function s(x)
5+
character(len=2) :: x, s, ss
6+
7+
s = x
8+
9+
entry ss()
10+
11+
end function s
12+

llvm/docs/TableGen/BackEnds.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,6 @@ function. This class provides three fields.
10711071

10721072
* ``bit EarlyOut``. See the third example in `Generic Tables`_.
10731073

1074-
* ``bit ReturnRange``. See the second example in `Generic Tables`_.
1075-
10761074
Here is an example of a secondary key added to the ``CTable`` above. The
10771075
generated function looks up entries based on the ``Name`` and ``Kind`` fields.
10781076

llvm/lib/TableGen/TGLexer.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {
8181
TokStart = nullptr;
8282

8383
// Pretend that we enter the "top-level" include file.
84-
PrepIncludeStack.push_back(
85-
std::make_unique<std::vector<PreprocessorControlDesc>>());
84+
PrepIncludeStack.emplace_back();
8685

8786
// Add all macros defined on the command line to the DefinedMacros set.
8887
// Check invalid macro names and print fatal error if we find one.
@@ -453,8 +452,7 @@ bool TGLexer::LexInclude() {
453452
CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer();
454453
CurPtr = CurBuf.begin();
455454

456-
PrepIncludeStack.push_back(
457-
std::make_unique<std::vector<PreprocessorControlDesc>>());
455+
PrepIncludeStack.emplace_back();
458456
return false;
459457
}
460458

@@ -656,17 +654,13 @@ tgtok::TokKind TGLexer::LexExclaim() {
656654
bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
657655
// Report an error, if preprocessor control stack for the current
658656
// file is not empty.
659-
if (!PrepIncludeStack.back()->empty()) {
657+
if (!PrepIncludeStack.back().empty()) {
660658
prepReportPreprocessorStackError();
661659

662660
return false;
663661
}
664662

665663
// Pop the preprocessing controls from the include stack.
666-
if (PrepIncludeStack.empty()) {
667-
PrintFatalError("preprocessor include stack is empty");
668-
}
669-
670664
PrepIncludeStack.pop_back();
671665

672666
if (IncludeStackMustBeEmpty) {
@@ -761,7 +755,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
761755
// Regardless of whether we are processing tokens or not,
762756
// we put the #ifdef control on stack.
763757
// Note that MacroIsDefined has been canonicalized against ifdef.
764-
PrepIncludeStack.back()->push_back(
758+
PrepIncludeStack.back().push_back(
765759
{tgtok::Ifdef, MacroIsDefined, SMLoc::getFromPointer(TokStart)});
766760

767761
if (!prepSkipDirectiveEnd())
@@ -789,10 +783,10 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
789783
} else if (Kind == tgtok::Else) {
790784
// Check if this #else is correct before calling prepSkipDirectiveEnd(),
791785
// which will move CurPtr away from the beginning of #else.
792-
if (PrepIncludeStack.back()->empty())
786+
if (PrepIncludeStack.back().empty())
793787
return ReturnError(TokStart, "#else without #ifdef or #ifndef");
794788

795-
PreprocessorControlDesc IfdefEntry = PrepIncludeStack.back()->back();
789+
PreprocessorControlDesc IfdefEntry = PrepIncludeStack.back().back();
796790

797791
if (IfdefEntry.Kind != tgtok::Ifdef) {
798792
PrintError(TokStart, "double #else");
@@ -801,9 +795,8 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
801795

802796
// Replace the corresponding #ifdef's control with its negation
803797
// on the control stack.
804-
PrepIncludeStack.back()->pop_back();
805-
PrepIncludeStack.back()->push_back(
806-
{Kind, !IfdefEntry.IsDefined, SMLoc::getFromPointer(TokStart)});
798+
PrepIncludeStack.back().back() = {Kind, !IfdefEntry.IsDefined,
799+
SMLoc::getFromPointer(TokStart)};
807800

808801
if (!prepSkipDirectiveEnd())
809802
return ReturnError(CurPtr, "only comments are supported after #else");
@@ -822,10 +815,10 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
822815
} else if (Kind == tgtok::Endif) {
823816
// Check if this #endif is correct before calling prepSkipDirectiveEnd(),
824817
// which will move CurPtr away from the beginning of #endif.
825-
if (PrepIncludeStack.back()->empty())
818+
if (PrepIncludeStack.back().empty())
826819
return ReturnError(TokStart, "#endif without #ifdef");
827820

828-
auto &IfdefOrElseEntry = PrepIncludeStack.back()->back();
821+
auto &IfdefOrElseEntry = PrepIncludeStack.back().back();
829822

830823
if (IfdefOrElseEntry.Kind != tgtok::Ifdef &&
831824
IfdefOrElseEntry.Kind != tgtok::Else) {
@@ -836,7 +829,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
836829
if (!prepSkipDirectiveEnd())
837830
return ReturnError(CurPtr, "only comments are supported after #endif");
838831

839-
PrepIncludeStack.back()->pop_back();
832+
PrepIncludeStack.back().pop_back();
840833

841834
// If we were processing tokens before this #endif, then
842835
// we should continue it.
@@ -1055,20 +1048,16 @@ bool TGLexer::prepSkipDirectiveEnd() {
10551048
}
10561049

10571050
bool TGLexer::prepIsProcessingEnabled() {
1058-
for (const PreprocessorControlDesc &I :
1059-
llvm::reverse(*PrepIncludeStack.back()))
1060-
if (!I.IsDefined)
1061-
return false;
1062-
1063-
return true;
1051+
return all_of(PrepIncludeStack.back(),
1052+
[](const PreprocessorControlDesc &I) { return I.IsDefined; });
10641053
}
10651054

10661055
void TGLexer::prepReportPreprocessorStackError() {
1067-
if (PrepIncludeStack.back()->empty())
1056+
if (PrepIncludeStack.back().empty())
10681057
PrintFatalError("prepReportPreprocessorStackError() called with "
10691058
"empty control stack");
10701059

1071-
auto &PrepControl = PrepIncludeStack.back()->back();
1060+
auto &PrepControl = PrepIncludeStack.back().back();
10721061
PrintError(CurBuf.end(), "reached EOF without matching #endif");
10731062
PrintError(PrepControl.SrcPos, "the latest preprocessor control is here");
10741063

llvm/lib/TableGen/TGLexer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_LIB_TABLEGEN_TGLEXER_H
1414
#define LLVM_LIB_TABLEGEN_TGLEXER_H
1515

16+
#include "llvm/ADT/SmallVector.h"
1617
#include "llvm/ADT/StringRef.h"
1718
#include "llvm/ADT/StringSet.h"
1819
#include "llvm/Support/DataTypes.h"
@@ -21,7 +22,6 @@
2122
#include <memory>
2223
#include <set>
2324
#include <string>
24-
#include <vector>
2525

2626
namespace llvm {
2727
template <typename T> class ArrayRef;
@@ -323,8 +323,7 @@ class TGLexer {
323323
// preprocessing control stacks for the current file and all its
324324
// parent files. The back() element is the preprocessing control
325325
// stack for the current file.
326-
std::vector<std::unique_ptr<std::vector<PreprocessorControlDesc>>>
327-
PrepIncludeStack;
326+
SmallVector<SmallVector<PreprocessorControlDesc>> PrepIncludeStack;
328327

329328
// Validate that the current preprocessing control stack is empty,
330329
// since we are about to exit a file, and pop the include stack.

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9760,10 +9760,14 @@ unsigned AMDGPUAsmParser::validateTargetOperandClass(MCParsedAsmOperand &Op,
97609760
case MCK_SReg_64:
97619761
case MCK_SReg_64_XEXEC:
97629762
// Null is defined as a 32-bit register but
9763-
// it should also be enabled with 64-bit operands.
9764-
// The following code enables it for SReg_64 operands
9763+
// it should also be enabled with 64-bit operands or larger.
9764+
// The following code enables it for SReg_64 and larger operands
97659765
// used as source and destination. Remaining source
97669766
// operands are handled in isInlinableImm.
9767+
case MCK_SReg_96:
9768+
case MCK_SReg_128:
9769+
case MCK_SReg_256:
9770+
case MCK_SReg_512:
97679771
return Operand.isNull() ? Match_Success : Match_InvalidOperand;
97689772
default:
97699773
return Match_InvalidOperand;

llvm/lib/Target/AMDGPU/BUFInstructions.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class getMTBUFInsDA<list<RegisterClass> vdataList,
168168
dag SOffset = !if(hasRestrictedSOffset, (ins SReg_32:$soffset),
169169
(ins SCSrc_b32:$soffset));
170170

171-
dag NonVaddrInputs = !con((ins SReg_128:$srsrc), SOffset,
171+
dag NonVaddrInputs = !con((ins SReg_128_XNULL:$srsrc), SOffset,
172172
(ins Offset:$offset, FORMAT:$format, CPol_0:$cpol, i1imm_0:$swz));
173173

174174
dag Inputs = !if(!empty(vaddrList),
@@ -418,7 +418,7 @@ class getMUBUFInsDA<list<RegisterClass> vdataList,
418418
RegisterOperand vdata_op = getLdStVDataRegisterOperand<vdataClass, isTFE>.ret;
419419

420420
dag SOffset = !if(hasRestrictedSOffset, (ins SReg_32:$soffset), (ins SCSrc_b32:$soffset));
421-
dag NonVaddrInputs = !con((ins SReg_128:$srsrc), SOffset, (ins Offset:$offset, CPol_0:$cpol, i1imm_0:$swz));
421+
dag NonVaddrInputs = !con((ins SReg_128_XNULL:$srsrc), SOffset, (ins Offset:$offset, CPol_0:$cpol, i1imm_0:$swz));
422422

423423
dag Inputs = !if(!empty(vaddrList), NonVaddrInputs, !con((ins vaddrClass:$vaddr), NonVaddrInputs));
424424
dag ret = !if(!empty(vdataList), Inputs, !con((ins vdata_op:$vdata), Inputs));
@@ -703,7 +703,7 @@ class getMUBUFAtomicInsDA<RegisterClass vdataClass, bit vdata_in, bit hasRestric
703703
dag VData = !if(vdata_in, (ins vdata_op:$vdata_in), (ins vdata_op:$vdata));
704704
dag Data = !if(!empty(vaddrList), VData, !con(VData, (ins vaddrClass:$vaddr)));
705705
dag SOffset = !if(hasRestrictedSOffset, (ins SReg_32:$soffset), (ins SCSrc_b32:$soffset));
706-
dag MainInputs = !con((ins SReg_128:$srsrc), SOffset, (ins Offset:$offset));
706+
dag MainInputs = !con((ins SReg_128_XNULL:$srsrc), SOffset, (ins Offset:$offset));
707707
dag CPol = !if(vdata_in, (ins CPol_GLC_WithDefault:$cpol),
708708
(ins CPol_NonGLC_WithDefault:$cpol));
709709

0 commit comments

Comments
 (0)