Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,53 @@ def test_with_run_command(self):
self.expect("frame variable month_13", substrs=["month_13 = month=13"])
self.expect("frame variable month_255", substrs=["month_255 = month=255"])

self.expect("frame variable sun", substrs=["sun = weekday=Sunday"])
self.expect("frame variable mon", substrs=["mon = weekday=Monday"])
self.expect("frame variable tue", substrs=["tue = weekday=Tuesday"])
self.expect("frame variable wed", substrs=["wed = weekday=Wednesday"])
self.expect("frame variable thu", substrs=["thu = weekday=Thursday"])
self.expect("frame variable fri", substrs=["fri = weekday=Friday"])
self.expect("frame variable sat", substrs=["sat = weekday=Saturday"])

self.expect("frame variable weekday_0", substrs=["weekday_0 = weekday=Sunday"])
self.expect("frame variable weekday_1", substrs=["weekday_1 = weekday=Monday"])
self.expect("frame variable weekday_2", substrs=["weekday_2 = weekday=Tuesday"])
self.expect(
"frame variable weekday_3", substrs=["weekday_3 = weekday=Wednesday"]
)
self.expect(
"frame variable weekday_4", substrs=["weekday_4 = weekday=Thursday"]
)
self.expect("frame variable weekday_5", substrs=["weekday_5 = weekday=Friday"])
self.expect(
"frame variable weekday_6", substrs=["weekday_6 = weekday=Saturday"]
)
self.expect("frame variable weekday_7", substrs=["weekday_7 = weekday=Sunday"])
self.expect("frame variable weekday_8", substrs=["weekday_8 = weekday=8"])
self.expect("frame variable weekday_255", substrs=["weekday_255 = weekday=255"])

self.expect(
"frame variable wdi_saturday_0",
substrs=["wdi_saturday_0 = weekday=Saturday index=0"],
)
self.expect(
"frame variable wdi_monday_1",
substrs=["wdi_monday_1 = weekday=Monday index=1"],
)
self.expect(
"frame variable wdi_invalid",
substrs=["wdi_invalid = weekday=255 index=255"],
)

self.expect(
"frame variable wdl_monday",
substrs=["wdl_monday = weekday=Monday index=last"],
)
self.expect(
"frame variable wdl_invalid",
substrs=["wdl_invalid = weekday=255 index=last"],
)

self.expect("frame variable y_min", substrs=["y_min = year=-32767"])
self.expect("frame variable y_0", substrs=["y_0 = year=0"])
self.expect("frame variable y_1970", substrs=["y_1970 = year=1970"])
Expand All @@ -91,6 +138,21 @@ def test_with_run_command(self):
substrs=["mdl_new_years_eve = month=December day=last"],
)

self.expect(
"frame variable mwd_first_thursday",
substrs=["mwd_first_thursday = month=January weekday=Thursday index=1"],
)

self.expect(
"frame variable mwdl_last_saturday",
substrs=["mwdl_last_saturday = month=December weekday=Saturday index=last"],
)

self.expect(
"frame variable ym_year_zero",
substrs=["ym_year_zero = year=0 month=January"],
)

self.expect("frame variable ymd_bc", substrs=["ymd_bc = date=-0001-03-255"])
self.expect(
"frame variable ymd_year_zero", substrs=["ymd_year_zero = date=0000-255-25"]
Expand All @@ -99,3 +161,34 @@ def test_with_run_command(self):
"frame variable ymd_unix_epoch",
substrs=["ymd_unix_epoch = date=1970-01-01"],
)

self.expect(
"frame variable ymdl_bc",
substrs=["ymdl_bc = year=-1 month=December day=last"],
)
self.expect(
"frame variable ymdl_may_1970",
substrs=["ymdl_may_1970 = year=1970 month=May day=last"],
)

self.expect(
"frame variable ymwd_bc",
substrs=["ymwd_bc = year=-1 month=June weekday=Wednesday index=2"],
)
self.expect(
"frame variable ymwd_forth_tuesday_2024",
substrs=[
"ymwd_forth_tuesday_2024 = year=2024 month=January weekday=Tuesday index=4"
],
)

self.expect(
"frame variable ymwdl_bc",
substrs=["ymwdl_bc = year=-1 month=April weekday=Friday index=last"],
)
self.expect(
"frame variable ymwdl_2024_last_tuesday_january",
substrs=[
"ymwdl_2024_last_tuesday_january = year=2024 month=January weekday=Tuesday index=last"
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,75 @@ int main() {
std::chrono::year y_2038{2038};
std::chrono::year y_max{std::chrono::year::max()};

std::chrono::weekday sun = std::chrono::Sunday;
std::chrono::weekday mon = std::chrono::Monday;
std::chrono::weekday tue = std::chrono::Tuesday;
std::chrono::weekday wed = std::chrono::Wednesday;
std::chrono::weekday thu = std::chrono::Thursday;
std::chrono::weekday fri = std::chrono::Friday;
std::chrono::weekday sat = std::chrono::Saturday;

std::chrono::weekday weekday_0{0};
std::chrono::weekday weekday_1{1};
std::chrono::weekday weekday_2{2};
std::chrono::weekday weekday_3{3};
std::chrono::weekday weekday_4{4};
std::chrono::weekday weekday_5{5};
std::chrono::weekday weekday_6{6};
std::chrono::weekday weekday_7{7};
std::chrono::weekday weekday_8{8};
std::chrono::weekday weekday_255{255};

std::chrono::weekday_indexed wdi_saturday_0{std::chrono::Saturday, 0};
std::chrono::weekday_indexed wdi_monday_1{std::chrono::Monday, 1};
std::chrono::weekday_indexed wdi_invalid{std::chrono::weekday{255}, 255};

std::chrono::weekday_last wdl_monday{std::chrono::Monday};
std::chrono::weekday_last wdl_invalid{std::chrono::weekday{255}};

std::chrono::month_day md_new_years_eve{std::chrono::December / 31};
std::chrono::month_day md_new_year{std::chrono::January / 1};
std::chrono::month_day md_invalid{std::chrono::month{255} / 255};

std::chrono::month_day_last mdl_jan{std::chrono::January};
std::chrono::month_day_last mdl_new_years_eve{std::chrono::December};

std::chrono::month_weekday mwd_first_thursday{
std::chrono::January,
std::chrono::weekday_indexed{std::chrono::Thursday, 1}};

std::chrono::month_weekday_last mwdl_last_saturday{
std::chrono::December, std::chrono::weekday_last{std::chrono::Saturday}};

std::chrono::year_month ym_year_zero{std::chrono::year{0},
std::chrono::January};

std::chrono::year_month_day ymd_bc{std::chrono::year{-1}, std::chrono::March,
std::chrono::day{255}};
std::chrono::year_month_day ymd_year_zero{
std::chrono::year{0}, std::chrono::month{255}, std::chrono::day{25}};
std::chrono::year_month_day ymd_unix_epoch{
std::chrono::year{1970}, std::chrono::January, std::chrono::day{1}};

std::chrono::year_month_day_last ymdl_bc{
std::chrono::year{-1},
std::chrono::month_day_last{std::chrono::December}};
std::chrono::year_month_day_last ymdl_may_1970{
std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::May}};

std::chrono::year_month_weekday ymwd_bc{
std::chrono::year{-1}, std::chrono::June,
std::chrono::weekday_indexed{std::chrono::Wednesday, 2}};
std::chrono::year_month_weekday ymwd_forth_tuesday_2024{
std::chrono::year{2024}, std::chrono::January,
std::chrono::weekday_indexed{std::chrono::Tuesday, 4}};

std::chrono::year_month_weekday_last ymwdl_bc{
std::chrono::year{-1}, std::chrono::April,
std::chrono::weekday_last{std::chrono::Friday}};
std::chrono::year_month_weekday_last ymwdl_2024_last_tuesday_january{
std::chrono::year{2024}, std::chrono::January,
std::chrono::weekday_last{std::chrono::Tuesday}};

std::cout << "break here\n";
}
7 changes: 2 additions & 5 deletions llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
Original file line number Diff line number Diff line change
Expand Up @@ -716,15 +716,12 @@ Intermediate Representation (IR) from the AST.
Full Code Listing
=================

Here is the complete code listing for our running example. Because this
uses the LLVM libraries, we need to link them in. To do this, we use the
`llvm-config <https://llvm.org/cmds/llvm-config.html>`_ tool to inform
our makefile/command line about which options to use:
Here is the complete code listing for our running example.

.. code-block:: bash
# Compile
clang++ -g -O3 toy.cpp `llvm-config --cxxflags`
clang++ -g -O3 toy.cpp
# Run
./a.out
Expand Down
4 changes: 0 additions & 4 deletions llvm/examples/Kaleidoscope/Chapter2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
set(LLVM_LINK_COMPONENTS
Support
)

add_kaleidoscope_chapter(Kaleidoscope-Ch2
toy.cpp
)
Expand Down
28 changes: 26 additions & 2 deletions llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#include "llvm/Analysis/CFGPrinter.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GraphWriter.h"
#include <unordered_set>

static std::unordered_set<std::string> nameObj;

namespace llvm {

Expand Down Expand Up @@ -83,10 +86,28 @@ struct DOTGraphTraitsViewer
StringRef Name;
};

static inline void shortenFileName(std::string &FN, unsigned char len = 250) {

FN = FN.substr(0, len);

auto strLen = FN.length();
while (strLen > 0) {
if (auto it = nameObj.find(FN); it != nameObj.end()) {
FN = FN.substr(0, --len);
} else {
nameObj.insert(FN);
break;
}
strLen--;
}
}

template <typename GraphT>
void printGraphForFunction(Function &F, GraphT Graph, StringRef Name,
bool IsSimple) {
std::string Filename = Name.str() + "." + F.getName().str() + ".dot";
std::string Filename = Name.str() + "." + F.getName().str();
shortenFileName(Filename);
Filename = Filename + ".dot";
std::error_code EC;

errs() << "Writing '" << Filename << "'...";
Expand Down Expand Up @@ -272,6 +293,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public ModulePass {

bool runOnModule(Module &M) override {
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
shortenFileName(Name);
std::string Filename = Name + ".dot";
std::error_code EC;

Expand Down Expand Up @@ -301,7 +323,9 @@ class DOTGraphTraitsModulePrinterWrapperPass : public ModulePass {
template <typename GraphT>
void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
std::string FileNamePrefix, bool IsSimple) {
std::string Filename = FileNamePrefix + "." + F.getName().str() + ".dot";
std::string Filename = FileNamePrefix + "." + F.getName().str();
shortenFileName(Filename);
Filename = Filename + ".dot";
std::error_code EC;

errs() << "Writing '" << Filename << "'...";
Expand Down
8 changes: 8 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsNVVM.td
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,14 @@ let TargetPrefix = "nvvm" in {
def int_nvvm_barrier_cluster_wait :
Intrinsic<[], [], [IntrConvergent, IntrNoCallback]>;

// 'aligned' versions of the above barrier.cluster.* intrinsics
def int_nvvm_barrier_cluster_arrive_aligned :
Intrinsic<[], [], [IntrConvergent, IntrNoCallback]>;
def int_nvvm_barrier_cluster_arrive_relaxed_aligned :
Intrinsic<[], [], [IntrConvergent, IntrNoCallback]>;
def int_nvvm_barrier_cluster_wait_aligned :
Intrinsic<[], [], [IntrConvergent, IntrNoCallback]>;

// Membar
def int_nvvm_membar_cta : ClangBuiltin<"__nvvm_membar_cta">,
Intrinsic<[], [], [IntrNoCallback]>;
Expand Down
39 changes: 39 additions & 0 deletions llvm/include/llvm/Passes/PassBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define LLVM_PASSES_PASSBUILDER_H

#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Passes/OptimizationLevel.h"
#include "llvm/Support/Error.h"
Expand Down Expand Up @@ -165,6 +166,14 @@ class PassBuilder {
/// additional analyses.
void registerLoopAnalyses(LoopAnalysisManager &LAM);

/// Registers all available machine function analysis passes.
///
/// This is an interface that can be used to populate a \c
/// MachineFunctionAnalysisManager with all registered function analyses.
/// Callers can still manually register any additional analyses. Callers can
/// also pre-register analyses and this will not override those.
void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM);

/// Construct the core LLVM function canonicalization and simplification
/// pipeline.
///
Expand Down Expand Up @@ -352,6 +361,18 @@ class PassBuilder {
Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText);
/// @}}

/// Parse a textual MIR pipeline into the provided \c MachineFunctionPass
/// manager.
/// The format of the textual machine pipeline is a comma separated list of
/// machine pass names:
///
/// machine-funciton-pass,machine-module-pass,...
///
/// There is no need to specify the pass nesting, and this function
/// currently cannot handle the pass nesting.
Error parsePassPipeline(MachineFunctionPassManager &MFPM,
StringRef PipelineText);

/// Parse a textual alias analysis pipeline into the provided AA manager.
///
/// The format of the textual AA pipeline is a comma separated list of AA
Expand Down Expand Up @@ -520,6 +541,10 @@ class PassBuilder {
const std::function<void(ModuleAnalysisManager &)> &C) {
ModuleAnalysisRegistrationCallbacks.push_back(C);
}
void registerAnalysisRegistrationCallback(
const std::function<void(MachineFunctionAnalysisManager &)> &C) {
MachineFunctionAnalysisRegistrationCallbacks.push_back(C);
}
/// @}}

/// {{@ Register pipeline parsing callbacks with this pass builder instance.
Expand All @@ -546,6 +571,11 @@ class PassBuilder {
ArrayRef<PipelineElement>)> &C) {
ModulePipelineParsingCallbacks.push_back(C);
}
void registerPipelineParsingCallback(
const std::function<bool(StringRef Name, MachineFunctionPassManager &)>
&C) {
MachinePipelineParsingCallbacks.push_back(C);
}
/// @}}

/// Register a callback for a top-level pipeline entry.
Expand Down Expand Up @@ -616,8 +646,12 @@ class PassBuilder {
Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E);
Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E);
Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E);
Error parseMachinePass(MachineFunctionPassManager &MFPM,
const PipelineElement &E);
bool parseAAPassName(AAManager &AA, StringRef Name);

Error parseMachinePassPipeline(MachineFunctionPassManager &MFPM,
ArrayRef<PipelineElement> Pipeline);
Error parseLoopPassPipeline(LoopPassManager &LPM,
ArrayRef<PipelineElement> Pipeline);
Error parseFunctionPassPipeline(FunctionPassManager &FPM,
Expand Down Expand Up @@ -699,6 +733,11 @@ class PassBuilder {
// AA callbacks
SmallVector<std::function<bool(StringRef Name, AAManager &AA)>, 2>
AAParsingCallbacks;
// Machine pass callbackcs
SmallVector<std::function<void(MachineFunctionAnalysisManager &)>, 2>
MachineFunctionAnalysisRegistrationCallbacks;
SmallVector<std::function<bool(StringRef, MachineFunctionPassManager &)>, 2>
MachinePipelineParsingCallbacks;
};

/// This utility template takes care of adding require<> and invalidate<>
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,8 +1108,8 @@ void ValueEnumerator::purgeFunction() {
/// Remove purged values from the ValueMap.
for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i)
ValueMap.erase(Values[i].first);
for (unsigned i = NumModuleMDs, e = MDs.size(); i != e; ++i)
MetadataMap.erase(MDs[i]);
for (const Metadata *MD : llvm::drop_begin(MDs, NumModuleMDs))
MetadataMap.erase(MD);
for (const BasicBlock *BB : BasicBlocks)
ValueMap.erase(BB);

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/RDFGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ bool DataFlowGraph::hasUntrackedRef(Stmt S, bool IgnoreReserved) const {
for (const MachineOperand &Op : S.Addr->getCode()->operands()) {
if (!Op.isReg() && !Op.isRegMask())
continue;
if (llvm::find(Ops, &Op) == Ops.end())
if (!llvm::is_contained(Ops, &Op))
return true;
}
return false;
Expand Down
5 changes: 1 addition & 4 deletions llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2210,15 +2210,12 @@ Register FastISel::fastEmitZExtFromI1(MVT VT, unsigned Op0) {
/// might result in multiple MBB's for one BB. As such, the start of the
/// BB might correspond to a different MBB than the end.
bool FastISel::handlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) {
const Instruction *TI = LLVMBB->getTerminator();

SmallPtrSet<MachineBasicBlock *, 4> SuccsHandled;
FuncInfo.OrigNumPHINodesToUpdate = FuncInfo.PHINodesToUpdate.size();

// Check successor nodes' PHI nodes that expect a constant to be available
// from this block.
for (unsigned succ = 0, e = TI->getNumSuccessors(); succ != e; ++succ) {
const BasicBlock *SuccBB = TI->getSuccessor(succ);
for (const BasicBlock *SuccBB : successors(LLVMBB)) {
if (!isa<PHINode>(SuccBB->begin()))
continue;
MachineBasicBlock *SuccMBB = FuncInfo.MBBMap[SuccBB];
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3534,8 +3534,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
Results.push_back(ExpandFABS(Node));
break;
case ISD::IS_FPCLASS: {
auto CNode = cast<ConstantSDNode>(Node->getOperand(1));
auto Test = static_cast<FPClassTest>(CNode->getZExtValue());
auto Test = static_cast<FPClassTest>(Node->getConstantOperandVal(1));
if (SDValue Expanded =
TLI.expandIS_FPCLASS(Node->getValueType(0), Node->getOperand(0),
Test, Node->getFlags(), SDLoc(Node), DAG))
Expand Down
16 changes: 4 additions & 12 deletions llvm/lib/IR/AutoUpgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2351,18 +2351,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
assert(Name.starts_with("llvm.") && "Intrinsic doesn't start with 'llvm.'");
Name = Name.substr(5);

bool IsX86 = Name.starts_with("x86.");
if (IsX86)
Name = Name.substr(4);
bool IsNVVM = Name.starts_with("nvvm.");
if (IsNVVM)
Name = Name.substr(5);
bool IsARM = Name.starts_with("arm.");
if (IsARM)
Name = Name.substr(4);
bool IsAMDGCN = Name.starts_with("amdgcn.");
if (IsAMDGCN)
Name = Name.substr(7);
bool IsX86 = Name.consume_front("x86.");
bool IsNVVM = Name.consume_front("nvvm.");
bool IsARM = Name.consume_front("arm.");
bool IsAMDGCN = Name.consume_front("amdgcn.");

if (IsX86 && Name.starts_with("sse4a.movnt.")) {
SmallVector<Metadata *, 1> Elts;
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/IR/Dominators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ static constexpr bool ExpensiveChecksEnabled = false;
#endif

bool BasicBlockEdge::isSingleEdge() const {
const Instruction *TI = Start->getTerminator();
unsigned NumEdgesToEnd = 0;
for (unsigned int i = 0, n = TI->getNumSuccessors(); i < n; ++i) {
if (TI->getSuccessor(i) == End)
for (const BasicBlock *Succ : successors(Start)) {
if (Succ == End)
++NumEdgesToEnd;
if (NumEdgesToEnd >= 2)
return false;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/IR/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ std::string GlobalValue::getGlobalIdentifier(StringRef Name,
// Value names may be prefixed with a binary '1' to indicate
// that the backend should not modify the symbols due to any platform
// naming convention. Do not include that '1' in the PGO profile name.
if (Name[0] == '\1')
Name = Name.substr(1);
Name.consume_front("\1");

std::string GlobalName;
if (llvm::GlobalValue::isLocalLinkage(Linkage)) {
Expand Down
9 changes: 3 additions & 6 deletions llvm/lib/IR/StructuralHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,9 @@ class StructuralHashImpl {
for (auto &Inst : *BB)
updateInstruction(Inst, DetailedHash);

const Instruction *Term = BB->getTerminator();
for (unsigned i = 0, e = Term->getNumSuccessors(); i != e; ++i) {
if (!VisitedBBs.insert(Term->getSuccessor(i)).second)
continue;
BBs.push_back(Term->getSuccessor(i));
}
for (const BasicBlock *Succ : successors(BB))
if (VisitedBBs.insert(Succ).second)
BBs.push_back(Succ);
}
}

Expand Down
82 changes: 82 additions & 0 deletions llvm/lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
#include "PassRegistry.def"

#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
PIC->addClassToPassName(PASS_NAME::name(), NAME);
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
PIC->addClassToPassName(PASS_NAME::name(), NAME);
#include "llvm/CodeGen/MachinePassRegistry.def"
}
}

Expand Down Expand Up @@ -427,6 +433,17 @@ void PassBuilder::registerFunctionAnalyses(FunctionAnalysisManager &FAM) {
C(FAM);
}

void PassBuilder::registerMachineFunctionAnalyses(
MachineFunctionAnalysisManager &MFAM) {

#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
MFAM.registerPass([&] { return PASS_NAME(); });
#include "llvm/CodeGen/MachinePassRegistry.def"

for (auto &C : MachineFunctionAnalysisRegistrationCallbacks)
C(MFAM);
}

void PassBuilder::registerLoopAnalyses(LoopAnalysisManager &LAM) {
#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
LAM.registerPass([&] { return CREATE_PASS; });
Expand Down Expand Up @@ -1781,6 +1798,33 @@ Error PassBuilder::parseLoopPass(LoopPassManager &LPM,
inconvertibleErrorCode());
}

Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM,
const PipelineElement &E) {
StringRef Name = E.Name;
if (!E.InnerPipeline.empty())
return make_error<StringError>("invalid pipeline",
inconvertibleErrorCode());

#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
if (Name == NAME) { \
MFPM.addPass(PASS_NAME()); \
return Error::success(); \
}
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
if (Name == NAME) { \
MFPM.addPass(PASS_NAME()); \
return Error::success(); \
}
#include "llvm/CodeGen/MachinePassRegistry.def"

for (auto &C : MachinePipelineParsingCallbacks)
if (C(Name, MFPM))
return Error::success();
return make_error<StringError>(
formatv("unknown machine pass '{0}'", Name).str(),
inconvertibleErrorCode());
}

bool PassBuilder::parseAAPassName(AAManager &AA, StringRef Name) {
#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (Name == NAME) { \
Expand All @@ -1802,6 +1846,15 @@ bool PassBuilder::parseAAPassName(AAManager &AA, StringRef Name) {
return false;
}

Error PassBuilder::parseMachinePassPipeline(
MachineFunctionPassManager &MFPM, ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
if (auto Err = parseMachinePass(MFPM, Element))
return Err;
}
return Error::success();
}

Error PassBuilder::parseLoopPassPipeline(LoopPassManager &LPM,
ArrayRef<PipelineElement> Pipeline) {
for (const auto &Element : Pipeline) {
Expand Down Expand Up @@ -1961,6 +2014,20 @@ Error PassBuilder::parsePassPipeline(LoopPassManager &CGPM,
return Error::success();
}

Error PassBuilder::parsePassPipeline(MachineFunctionPassManager &MFPM,
StringRef PipelineText) {
auto Pipeline = parsePipelineText(PipelineText);
if (!Pipeline || Pipeline->empty())
return make_error<StringError>(
formatv("invalid machine pass pipeline '{0}'", PipelineText).str(),
inconvertibleErrorCode());

if (auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
return Err;

return Error::success();
}

Error PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
// If the pipeline just consists of the word 'default' just replace the AA
// manager with our default one.
Expand Down Expand Up @@ -2055,6 +2122,21 @@ void PassBuilder::printPassNames(raw_ostream &OS) {
OS << "Loop analyses:\n";
#define LOOP_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
#include "PassRegistry.def"

OS << "Machine module passes (WIP):\n";
#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
#include "llvm/CodeGen/MachinePassRegistry.def"

OS << "Machine function passes (WIP):\n";
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
#include "llvm/CodeGen/MachinePassRegistry.def"

OS << "Machine function analyses (WIP):\n";
#define MACHINE_FUNCTION_ANALYSIS(NAME, PASS_NAME, CONSTRUCTOR) \
printPassName(NAME, OS);
#include "llvm/CodeGen/MachinePassRegistry.def"
}

void PassBuilder::registerParseTopLevelPipelineCallback(
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ elseif( CMAKE_HOST_UNIX )
set(system_libs ${system_libs} m)
endif()
if( UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
set(system_libs ${system_libs} kstat)
set(system_libs ${system_libs} kstat socket)
endif()
if( FUCHSIA )
set(system_libs ${system_libs} zircon)
endif()
if ( HAIKU )
add_compile_definitions(_BSD_SOURCE)
set(system_libs ${system_libs} bsd)
set(system_libs ${system_libs} bsd network)
endif()
endif( MSVC OR MINGW )

Expand Down
8 changes: 2 additions & 6 deletions llvm/lib/Support/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1630,10 +1630,8 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
// otherwise feed it to the eating positional.
ArgName = StringRef(argv[i] + 1);
// Eat second dash.
if (!ArgName.empty() && ArgName[0] == '-') {
if (ArgName.consume_front("-"))
HaveDoubleDash = true;
ArgName = ArgName.substr(1);
}

Handler = LookupLongOption(*ChosenSubCommand, ArgName, Value,
LongOptionsUseDoubleDash, HaveDoubleDash);
Expand All @@ -1644,10 +1642,8 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
} else { // We start with a '-', must be an argument.
ArgName = StringRef(argv[i] + 1);
// Eat second dash.
if (!ArgName.empty() && ArgName[0] == '-') {
if (ArgName.consume_front("-"))
HaveDoubleDash = true;
ArgName = ArgName.substr(1);
}

Handler = LookupLongOption(*ChosenSubCommand, ArgName, Value,
LongOptionsUseDoubleDash, HaveDoubleDash);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Support/FormatVariadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ formatv_object_base::parseReplacementItem(StringRef Spec) {
return ReplacementItem{};
}
RepString = RepString.trim();
if (!RepString.empty() && RepString.front() == ',') {
RepString = RepString.drop_front();
if (RepString.consume_front(",")) {
if (!consumeFieldLayout(RepString, Where, Align, Pad))
assert(false && "Invalid replacement field layout specification!");
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Support/StringRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,7 @@ bool StringRef::consumeInteger(unsigned Radix, APInt &Result) {

// Skip leading zeroes. This can be a significant improvement if
// it means we don't need > 64 bits.
while (!Str.empty() && Str.front() == '0')
Str = Str.substr(1);
Str = Str.ltrim('0');

// If it was nothing but zeroes....
if (Str.empty()) {
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Support/VersionTuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ bool VersionTuple::tryParse(StringRef input) {
}

// If we're not done, parse the micro version, \.[0-9]+
if (input[0] != '.')
if (!input.consume_front("."))
return true;
input = input.substr(1);
if (parseInt(input, micro))
return true;

Expand All @@ -97,9 +96,8 @@ bool VersionTuple::tryParse(StringRef input) {
}

// If we're not done, parse the micro version, \.[0-9]+
if (input[0] != '.')
if (!input.consume_front("."))
return true;
input = input.substr(1);
if (parseInt(input, build))
return true;

Expand Down
17 changes: 8 additions & 9 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2164,9 +2164,8 @@ void AArch64TargetLowering::computeKnownBitsForTargetNode(
break;
}
case AArch64ISD::MOVI: {
ConstantSDNode *CN = cast<ConstantSDNode>(Op->getOperand(0));
Known =
KnownBits::makeConstant(APInt(Known.getBitWidth(), CN->getZExtValue()));
Known = KnownBits::makeConstant(
APInt(Known.getBitWidth(), Op->getConstantOperandVal(0)));
break;
}
case AArch64ISD::LOADgot:
Expand All @@ -2183,8 +2182,8 @@ void AArch64TargetLowering::computeKnownBitsForTargetNode(
break;
}
case ISD::INTRINSIC_W_CHAIN: {
ConstantSDNode *CN = cast<ConstantSDNode>(Op->getOperand(1));
Intrinsic::ID IntID = static_cast<Intrinsic::ID>(CN->getZExtValue());
Intrinsic::ID IntID =
static_cast<Intrinsic::ID>(Op->getConstantOperandVal(1));
switch (IntID) {
default: return;
case Intrinsic::aarch64_ldaxr:
Expand Down Expand Up @@ -22284,8 +22283,8 @@ static SDValue performSETCCCombine(SDNode *N,
isNullConstant(LHS->getOperand(0)) && isOneConstant(LHS->getOperand(1)) &&
LHS->hasOneUse()) {
// Invert CSEL's condition.
auto *OpCC = cast<ConstantSDNode>(LHS.getOperand(2));
auto OldCond = static_cast<AArch64CC::CondCode>(OpCC->getZExtValue());
auto OldCond =
static_cast<AArch64CC::CondCode>(LHS.getConstantOperandVal(2));
auto NewCond = getInvertedCondCode(OldCond);

// csel 0, 1, !cond, X
Expand Down Expand Up @@ -24717,8 +24716,8 @@ void AArch64TargetLowering::ReplaceNodeResults(
assert((VT == MVT::i8 || VT == MVT::i16) &&
"custom lowering for unexpected type");

ConstantSDNode *CN = cast<ConstantSDNode>(N->getOperand(0));
Intrinsic::ID IntID = static_cast<Intrinsic::ID>(CN->getZExtValue());
Intrinsic::ID IntID =
static_cast<Intrinsic::ID>(N->getConstantOperandVal(0));
switch (IntID) {
default:
return;
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,8 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
auto IndexedLoadBasicPred = [=](const LegalityQuery &Query) {
LLT LdTy = Query.Types[0];
LLT PtrTy = Query.Types[1];
if (llvm::find(PackedVectorAllTypesVec, LdTy) ==
PackedVectorAllTypesVec.end() &&
llvm::find(ScalarAndPtrTypesVec, LdTy) == ScalarAndPtrTypesVec.end() &&
LdTy != s128)
if (!llvm::is_contained(PackedVectorAllTypesVec, LdTy) &&
!llvm::is_contained(ScalarAndPtrTypesVec, LdTy) && LdTy != s128)
return false;
if (PtrTy != p0)
return false;
Expand Down
13 changes: 4 additions & 9 deletions llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,17 +1619,15 @@ static SDValue ReorganizeVector(SelectionDAG &DAG, SDValue VectorEntry,
for (unsigned i = 0; i < 4; i++) {
RemapSwizzle[i] = i;
if (NewBldVec[i].getOpcode() == ISD::EXTRACT_VECTOR_ELT) {
unsigned Idx = cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
->getZExtValue();
unsigned Idx = NewBldVec[i].getConstantOperandVal(1);
if (i == Idx)
isUnmovable[Idx] = true;
}
}

for (unsigned i = 0; i < 4; i++) {
if (NewBldVec[i].getOpcode() == ISD::EXTRACT_VECTOR_ELT) {
unsigned Idx = cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
->getZExtValue();
unsigned Idx = NewBldVec[i].getConstantOperandVal(1);
if (isUnmovable[Idx])
continue;
// Swap i and Idx
Expand Down Expand Up @@ -2002,9 +2000,7 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
if (RegisterSDNode *Reg =
dyn_cast<RegisterSDNode>(ParentNode->getOperand(OtherSrcIdx))) {
if (Reg->getReg() == R600::ALU_CONST) {
ConstantSDNode *Cst
= cast<ConstantSDNode>(ParentNode->getOperand(OtherSelIdx));
Consts.push_back(Cst->getZExtValue());
Consts.push_back(ParentNode->getConstantOperandVal(OtherSelIdx));
}
}
}
Expand Down Expand Up @@ -2044,8 +2040,7 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
ImmValue = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
}
} else {
ConstantSDNode *C = cast<ConstantSDNode>(Src.getOperand(0));
uint64_t Value = C->getZExtValue();
uint64_t Value = Src.getConstantOperandVal(0);
if (Value == 0) {
ImmReg = R600::ZERO;
} else if (Value == 1) {
Expand Down
10 changes: 3 additions & 7 deletions llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5742,8 +5742,7 @@ SDValue SITargetLowering::lowerIntrinsicLoad(MemSDNode *M, bool IsFormat,
static SDValue lowerICMPIntrinsic(const SITargetLowering &TLI,
SDNode *N, SelectionDAG &DAG) {
EVT VT = N->getValueType(0);
const auto *CD = cast<ConstantSDNode>(N->getOperand(3));
unsigned CondCode = CD->getZExtValue();
unsigned CondCode = N->getConstantOperandVal(3);
if (!ICmpInst::isIntPredicate(static_cast<ICmpInst::Predicate>(CondCode)))
return DAG.getUNDEF(VT);

Expand Down Expand Up @@ -5777,9 +5776,8 @@ static SDValue lowerICMPIntrinsic(const SITargetLowering &TLI,
static SDValue lowerFCMPIntrinsic(const SITargetLowering &TLI,
SDNode *N, SelectionDAG &DAG) {
EVT VT = N->getValueType(0);
const auto *CD = cast<ConstantSDNode>(N->getOperand(3));

unsigned CondCode = CD->getZExtValue();
unsigned CondCode = N->getConstantOperandVal(3);
if (!FCmpInst::isFPPredicate(static_cast<FCmpInst::Predicate>(CondCode)))
return DAG.getUNDEF(VT);

Expand Down Expand Up @@ -7419,9 +7417,7 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
NumVDataDwords = Is64Bit ? 2 : 1;
}
} else {
auto *DMaskConst =
cast<ConstantSDNode>(Op.getOperand(ArgOffset + Intr->DMaskIndex));
DMask = DMaskConst->getZExtValue();
DMask = Op->getConstantOperandVal(ArgOffset + Intr->DMaskIndex);
DMaskLanes = BaseOpcode->Gather4 ? 4 : llvm::popcount(DMask);

if (BaseOpcode->Store) {
Expand Down
11 changes: 5 additions & 6 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4246,8 +4246,7 @@ ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG,
static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG,
const ARMSubtarget *Subtarget) {
SDLoc dl(Op);
ConstantSDNode *SSIDNode = cast<ConstantSDNode>(Op.getOperand(2));
auto SSID = static_cast<SyncScope::ID>(SSIDNode->getZExtValue());
auto SSID = static_cast<SyncScope::ID>(Op.getConstantOperandVal(2));
if (SSID == SyncScope::SingleThread)
return Op;

Expand All @@ -4261,8 +4260,8 @@ static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG,
DAG.getConstant(0, dl, MVT::i32));
}

ConstantSDNode *OrdN = cast<ConstantSDNode>(Op.getOperand(1));
AtomicOrdering Ord = static_cast<AtomicOrdering>(OrdN->getZExtValue());
AtomicOrdering Ord =
static_cast<AtomicOrdering>(Op.getConstantOperandVal(1));
ARM_MB::MemBOpt Domain = ARM_MB::ISH;
if (Subtarget->isMClass()) {
// Only a full system barrier exists in the M-class architectures.
Expand Down Expand Up @@ -20087,8 +20086,8 @@ void ARMTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
return;
}
case ISD::INTRINSIC_W_CHAIN: {
ConstantSDNode *CN = cast<ConstantSDNode>(Op->getOperand(1));
Intrinsic::ID IntID = static_cast<Intrinsic::ID>(CN->getZExtValue());
Intrinsic::ID IntID =
static_cast<Intrinsic::ID>(Op->getConstantOperandVal(1));
switch (IntID) {
default: return;
case Intrinsic::arm_ldaex:
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,7 @@ void HexagonDAGToDAGISel::SelectIntrinsicWOChain(SDNode *N) {
void HexagonDAGToDAGISel::SelectExtractSubvector(SDNode *N) {
SDValue Inp = N->getOperand(0);
MVT ResTy = N->getValueType(0).getSimpleVT();
auto IdxN = cast<ConstantSDNode>(N->getOperand(1));
unsigned Idx = IdxN->getZExtValue();
unsigned Idx = N->getConstantOperandVal(1);

[[maybe_unused]] MVT InpTy = Inp.getValueType().getSimpleVT();
[[maybe_unused]] unsigned ResLen = ResTy.getVectorNumElements();
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2573,8 +2573,7 @@ SDValue HvxSelector::getVectorConstant(ArrayRef<uint8_t> Data,
void HvxSelector::selectExtractSubvector(SDNode *N) {
SDValue Inp = N->getOperand(0);
MVT ResTy = N->getValueType(0).getSimpleVT();
auto IdxN = cast<ConstantSDNode>(N->getOperand(1));
unsigned Idx = IdxN->getZExtValue();
unsigned Idx = N->getConstantOperandVal(1);

[[maybe_unused]] MVT InpTy = Inp.getValueType().getSimpleVT();
[[maybe_unused]] unsigned ResLen = ResTy.getVectorNumElements();
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5262,9 +5262,7 @@ static SDValue PerformANDCombine(SDNode *N,
return SDValue();
}

unsigned ExtType =
cast<ConstantSDNode>(Val->getOperand(Val->getNumOperands()-1))->
getZExtValue();
unsigned ExtType = Val->getConstantOperandVal(Val->getNumOperands() - 1);
if (ExtType == ISD::SEXTLOAD) {
// If for some reason the load is a sextload, the and is needed to zero
// out the high 8 bits
Expand Down
10 changes: 10 additions & 0 deletions llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def INT_BARRIER_SYNC_CNT_II : NVPTXInst<(outs), (ins i32imm:$id, i32imm:$cnt),
"barrier.sync \t$id, $cnt;",
[(int_nvvm_barrier_sync_cnt imm:$id, imm:$cnt)]>,
Requires<[hasPTX<60>, hasSM<30>]>;

class INT_BARRIER_CLUSTER<string variant, Intrinsic Intr,
list<Predicate> Preds = [hasPTX<78>, hasSM<90>]>:
NVPTXInst<(outs), (ins), "barrier.cluster."# variant #";", [(Intr)]>,
Expand All @@ -145,6 +146,15 @@ def barrier_cluster_arrive_relaxed:
def barrier_cluster_wait:
INT_BARRIER_CLUSTER<"wait", int_nvvm_barrier_cluster_wait>;

// 'aligned' versions of the cluster barrier intrinsics
def barrier_cluster_arrive_aligned:
INT_BARRIER_CLUSTER<"arrive.aligned", int_nvvm_barrier_cluster_arrive_aligned>;
def barrier_cluster_arrive_relaxed_aligned:
INT_BARRIER_CLUSTER<"arrive.relaxed.aligned",
int_nvvm_barrier_cluster_arrive_relaxed_aligned, [hasPTX<80>, hasSM<90>]>;
def barrier_cluster_wait_aligned:
INT_BARRIER_CLUSTER<"wait.aligned", int_nvvm_barrier_cluster_wait_aligned>;

class SHFL_INSTR<bit sync, string mode, string reg, bit return_pred,
bit offset_imm, bit mask_imm, bit threadmask_imm>
: NVPTXInst<(outs), (ins), "?", []> {
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ void RISCVRegisterInfo::lowerVSPILL(MachineBasicBlock::iterator II) const {
MachineBasicBlock &MBB = *II->getParent();
MachineFunction &MF = *MBB.getParent();
MachineRegisterInfo &MRI = MF.getRegInfo();
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
const TargetInstrInfo *TII = STI.getInstrInfo();
const TargetRegisterInfo *TRI = STI.getRegisterInfo();

auto ZvlssegInfo = RISCV::isRVVSpillForZvlsseg(II->getOpcode());
unsigned NF = ZvlssegInfo->first;
Expand Down Expand Up @@ -303,7 +304,6 @@ void RISCVRegisterInfo::lowerVSPILL(MachineBasicBlock::iterator II) const {

Register VL = MRI.createVirtualRegister(&RISCV::GPRRegClass);
// Optimize for constant VLEN.
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
if (STI.getRealMinVLen() == STI.getRealMaxVLen()) {
const int64_t VLENB = STI.getRealMinVLen() / 8;
int64_t Offset = VLENB * LMUL;
Expand Down Expand Up @@ -347,8 +347,9 @@ void RISCVRegisterInfo::lowerVRELOAD(MachineBasicBlock::iterator II) const {
MachineBasicBlock &MBB = *II->getParent();
MachineFunction &MF = *MBB.getParent();
MachineRegisterInfo &MRI = MF.getRegInfo();
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
const TargetInstrInfo *TII = STI.getInstrInfo();
const TargetRegisterInfo *TRI = STI.getRegisterInfo();

auto ZvlssegInfo = RISCV::isRVVSpillForZvlsseg(II->getOpcode());
unsigned NF = ZvlssegInfo->first;
Expand Down Expand Up @@ -380,7 +381,6 @@ void RISCVRegisterInfo::lowerVRELOAD(MachineBasicBlock::iterator II) const {

Register VL = MRI.createVirtualRegister(&RISCV::GPRRegClass);
// Optimize for constant VLEN.
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
if (STI.getRealMinVLen() == STI.getRealMaxVLen()) {
const int64_t VLENB = STI.getRealMinVLen() / 8;
int64_t Offset = VLENB * LMUL;
Expand Down
19 changes: 12 additions & 7 deletions llvm/lib/Target/Sparc/SparcSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "SparcSubtarget.h"
#include "Sparc.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/MathExtras.h"

Expand All @@ -25,15 +26,18 @@ using namespace llvm;

void SparcSubtarget::anchor() { }

SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
StringRef FS) {
SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(
StringRef CPU, StringRef TuneCPU, StringRef FS) {
// Determine default and user specified characteristics
std::string CPUName = std::string(CPU);
if (CPUName.empty())
CPUName = (Is64Bit) ? "v9" : "v8";

if (TuneCPU.empty())
TuneCPU = CPUName;

// Parse features string.
ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
ParseSubtargetFeatures(CPUName, TuneCPU, FS);

// Popc is a v9-only instruction.
if (!IsV9)
Expand All @@ -42,11 +46,12 @@ SparcSubtarget &SparcSubtarget::initializeSubtargetDependencies(StringRef CPU,
return *this;
}

SparcSubtarget::SparcSubtarget(const Triple &TT, const std::string &CPU,
const std::string &FS, const TargetMachine &TM,
SparcSubtarget::SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
const StringRef &FS, const TargetMachine &TM,
bool is64Bit)
: SparcGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), TargetTriple(TT),
Is64Bit(is64Bit), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
: SparcGenSubtargetInfo(TM.getTargetTriple(), CPU, TuneCPU, FS),
TargetTriple(TM.getTargetTriple()), Is64Bit(is64Bit),
InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),
TLInfo(TM, *this), FrameLowering(*this) {}

int SparcSubtarget::getAdjustedFrameSize(int frameSize) const {
Expand Down
8 changes: 5 additions & 3 deletions llvm/lib/Target/Sparc/SparcSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
SparcFrameLowering FrameLowering;

public:
SparcSubtarget(const Triple &TT, const std::string &CPU,
const std::string &FS, const TargetMachine &TM, bool is64bit);
SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
const StringRef &FS, const TargetMachine &TM, bool is64bit);

const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
const TargetFrameLowering *getFrameLowering() const override {
Expand All @@ -70,7 +70,9 @@ class SparcSubtarget : public SparcGenSubtargetInfo {
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
SparcSubtarget &initializeSubtargetDependencies(StringRef CPU,
StringRef TuneCPU,
StringRef FS);

bool is64Bit() const { return Is64Bit; }

Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Target/Sparc/SparcTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,13 @@ SparcTargetMachine::~SparcTargetMachine() = default;
const SparcSubtarget *
SparcTargetMachine::getSubtargetImpl(const Function &F) const {
Attribute CPUAttr = F.getFnAttribute("target-cpu");
Attribute TuneAttr = F.getFnAttribute("tune-cpu");
Attribute FSAttr = F.getFnAttribute("target-features");

std::string CPU =
CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
std::string TuneCPU =
TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
std::string FS =
FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;

Expand All @@ -137,8 +140,8 @@ SparcTargetMachine::getSubtargetImpl(const Function &F) const {
// creation will depend on the TM and the code generation flags on the
// function that reside in TargetOptions.
resetTargetOptions(F);
I = std::make_unique<SparcSubtarget>(TargetTriple, CPU, FS, *this,
this->is64Bit);
I = std::make_unique<SparcSubtarget>(CPU, TuneCPU, FS, *this,
this->is64Bit);
}
return I.get();
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6046,8 +6046,7 @@ SDValue SystemZTargetLowering::lowerIS_FPCLASS(SDValue Op,
SDLoc DL(Op);
MVT ResultVT = Op.getSimpleValueType();
SDValue Arg = Op.getOperand(0);
auto CNode = cast<ConstantSDNode>(Op.getOperand(1));
unsigned Check = CNode->getZExtValue();
unsigned Check = Op.getConstantOperandVal(1);

unsigned TDCMask = 0;
if (Check & fcSNan)
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
#include "WebAssemblyMachineFunctionInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Function.h"

using namespace llvm;

WebAssemblyDebugValueManager::WebAssemblyDebugValueManager(MachineInstr *Def)
: Def(Def) {
if (!Def->getMF()->getFunction().getSubprogram())
return;

// This code differs from MachineInstr::collectDebugValues in that it scans
// the whole BB, not just contiguous DBG_VALUEs, until another definition to
// the same register is encountered.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,8 +2355,7 @@ SDValue X86DAGToDAGISel::matchIndexRecursively(SDValue N,
Src.hasOneUse()) {
if (CurDAG->isBaseWithConstantOffset(Src)) {
SDValue AddSrc = Src.getOperand(0);
auto *AddVal = cast<ConstantSDNode>(Src.getOperand(1));
uint64_t Offset = (uint64_t)AddVal->getZExtValue();
uint64_t Offset = Src.getConstantOperandVal(1);
if (!foldOffsetIntoAddress(Offset * AM.Scale, AM)) {
SDLoc DL(N);
SDValue Res;
Expand Down
7 changes: 5 additions & 2 deletions llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ MachineInstr *X86SpeculativeLoadHardeningPass::sinkPostLoadHardenedInst(
// just bail. Also check that its register class is one of the ones we
// can harden.
Register UseDefReg = UseMI.getOperand(0).getReg();
if (!UseDefReg.isVirtual() || !canHardenRegister(UseDefReg))
if (!canHardenRegister(UseDefReg))
return {};

SingleUseMI = &UseMI;
Expand All @@ -1863,6 +1863,10 @@ MachineInstr *X86SpeculativeLoadHardeningPass::sinkPostLoadHardenedInst(
}

bool X86SpeculativeLoadHardeningPass::canHardenRegister(Register Reg) {
// We only support hardening virtual registers.
if (!Reg.isVirtual())
return false;

auto *RC = MRI->getRegClass(Reg);
int RegBytes = TRI->getRegSizeInBits(*RC) / 8;
if (RegBytes > 8)
Expand Down Expand Up @@ -1909,7 +1913,6 @@ unsigned X86SpeculativeLoadHardeningPass::hardenValueInRegister(
Register Reg, MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertPt,
const DebugLoc &Loc) {
assert(canHardenRegister(Reg) && "Cannot harden this register!");
assert(Reg.isVirtual() && "Cannot harden a physical register!");

auto *RC = MRI->getRegClass(Reg);
int Bytes = TRI->getRegSizeInBits(*RC) / 8;
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/TextAPI/RecordsSlice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ llvm::MachO::convertToInterfaceFile(const Records &Slices) {
}

File = createInterfaceFile(Slices, *InstallNames.begin());
for (auto it = std::next(InstallNames.begin()); it != InstallNames.end();
++it)
File->addDocument(createInterfaceFile(Slices, *it));
for (StringRef IN : llvm::drop_begin(InstallNames))
File->addDocument(createInterfaceFile(Slices, IN));

return File;
}
9 changes: 0 additions & 9 deletions llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5703,15 +5703,6 @@ Instruction *InstCombinerImpl::foldICmpWithCastOp(ICmpInst &ICmp) {
return new ICmpInst(ICmp.getPredicate(), Op0Src, NewOp1);
}

// Turn icmp pred (inttoptr x), (inttoptr y) into icmp pred x, y
if (CastOp0->getOpcode() == Instruction::IntToPtr &&
CompatibleSizes(DestTy, SrcTy)) {
Value *Op1Src;
if (match(ICmp.getOperand(1), m_IntToPtr(m_Value(Op1Src))) &&
Op1Src->getType() == SrcTy)
return new ICmpInst(ICmp.getPredicate(), Op0Src, Op1Src);
}

if (Instruction *R = foldICmpWithTrunc(ICmp))
return R;

Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/NVPTX/intrinsics-sm90.ll
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ define void @test_barrier_cluster() {
ret void
}

; CHECK-LABEL: test_barrier_cluster_aligned(
define void @test_barrier_cluster_aligned() {
; CHECK: barrier.cluster.arrive.aligned;
call void @llvm.nvvm.barrier.cluster.arrive.aligned()
; CHECK: barrier.cluster.arrive.relaxed.aligned;
call void @llvm.nvvm.barrier.cluster.arrive.relaxed.aligned()
; CHECK: barrier.cluster.wait.aligned;
call void @llvm.nvvm.barrier.cluster.wait.aligned()
ret void
}

declare i1 @llvm.nvvm.isspacep.shared.cluster(ptr %p);
declare ptr @llvm.nvvm.mapa(ptr %p, i32 %r);
Expand All @@ -153,4 +163,7 @@ declare i1 @llvm.nvvm.is_explicit_cluster()
declare void @llvm.nvvm.barrier.cluster.arrive()
declare void @llvm.nvvm.barrier.cluster.arrive.relaxed()
declare void @llvm.nvvm.barrier.cluster.wait()
declare void @llvm.nvvm.barrier.cluster.arrive.aligned()
declare void @llvm.nvvm.barrier.cluster.arrive.relaxed.aligned()
declare void @llvm.nvvm.barrier.cluster.wait.aligned()
declare void @llvm.nvvm.fence.sc.cluster()
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/WebAssembly/cfg-stackify-dbg-skip.ll
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

target triple = "wasm32-unknown-unknown"

define void @foo(i64 %arg) {
define void @foo(i64 %arg) !dbg !37 {
start:
%val = trunc i64 %arg to i32
%cmp = icmp eq i32 %val, 0
Expand All @@ -39,7 +39,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
!22 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "&str", file: !6, size: 64, align: 32, elements: !{}, identifier: "111094d970b097647de579f9c509ef08")
!33 = !{i32 2, !"Debug Info Version", i32 3}
!35 = distinct !DILexicalBlock(scope: !37, file: !6, line: 357, column: 8)
!37 = distinct !DISubprogram(name: "foobar", linkageName: "_fooba", scope: !38, file: !6, line: 353, type: !39, isLocal: true, isDefinition: true, scopeLine: 353, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, retainedNodes: !42)
!37 = distinct !DISubprogram(name: "foo", scope: !6, file: !6, line: 353, type: !39, isLocal: true, isDefinition: true, scopeLine: 353, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, retainedNodes: !42)
!38 = !DINamespace(name: "ptr", scope: null)
!39 = !DISubroutineType(types: !2)
!42 = !{!46}
Expand Down
31 changes: 31 additions & 0 deletions llvm/test/CodeGen/X86/speculative-load-hardening.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1161,3 +1161,34 @@ define void @idempotent_atomic(ptr %x) speculative_load_hardening {
%tmp = atomicrmw or ptr %x, i32 0 seq_cst
ret void
}

; Make sure we don't crash on longjmps (PR60081).
declare void @llvm.eh.sjlj.longjmp(ptr)
define void @test_longjmp(ptr %env) speculative_load_hardening {
; X64-LABEL: test_longjmp:
; X64: # %bb.0:
; X64-NEXT: pushq %rbp
; X64-NEXT: .cfi_def_cfa_offset 16
; X64-NEXT: .cfi_offset %rbp, -16
; X64-NEXT: movq %rsp, %rax
; X64-NEXT: movq $-1, %rcx
; X64-NEXT: sarq $63, %rax
; X64-NEXT: orq %rax, %rdi
; X64-NEXT: movq (%rdi), %rbp
; X64-NEXT: movq 8(%rdi), %rcx
; X64-NEXT: movq 16(%rdi), %rsp
; X64-NEXT: orq %rax, %rcx
; X64-NEXT: jmpq *%rcx
;
; X64-LFENCE-LABEL: test_longjmp:
; X64-LFENCE: # %bb.0:
; X64-LFENCE-NEXT: pushq %rbp
; X64-LFENCE-NEXT: .cfi_def_cfa_offset 16
; X64-LFENCE-NEXT: .cfi_offset %rbp, -16
; X64-LFENCE-NEXT: movq (%rdi), %rbp
; X64-LFENCE-NEXT: movq 8(%rdi), %rax
; X64-LFENCE-NEXT: movq 16(%rdi), %rsp
; X64-LFENCE-NEXT: jmpq *%rax
call void @llvm.eh.sjlj.longjmp(ptr %env)
unreachable
}
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/WebAssembly/dbg-value-move-clone.mir
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
declare void @foo(i32)
declare i32 @bar()

define void @test(i64 %arg) {
define void @test(i64 %arg) !dbg !6 {
unreachable
}

Expand All @@ -32,7 +32,7 @@
!3 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "&str", file: !2, size: 64, align: 32, elements: !{}, identifier: "111094d970b097647de579f9c509ef08")
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DILexicalBlock(scope: !6, file: !2, line: 357, column: 8)
!6 = distinct !DISubprogram(name: "testfoo", linkageName: "_testba", scope: !7, file: !2, line: 353, type: !8, isLocal: true, isDefinition: true, scopeLine: 353, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !1, retainedNodes: !9)
!6 = distinct !DISubprogram(name: "test", scope: !7, file: !2, line: 353, type: !8, isLocal: true, isDefinition: true, scopeLine: 353, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !1, retainedNodes: !9)
!7 = !DINamespace(name: "ptr", scope: null)
!8 = !DISubroutineType(types: !1)
!9 = !{!10}
Expand Down
35 changes: 23 additions & 12 deletions llvm/test/DebugInfo/WebAssembly/dbg-value-reg-stackify.mir
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,44 @@
declare void @use(i32)
declare void @use_2(i32, i32)

define void @sink_simple() {
define void @sink_simple() !dbg !6 {
call void @llvm.dbg.value(metadata i32 0, metadata !5, metadata !DIExpression()), !dbg !10
call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !10
call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !DIExpression()), !dbg !10
call void @llvm.dbg.value(metadata i32 0, metadata !13, metadata !DIExpression()), !dbg !10
ret void
}
define void @sink_non_consecutive() {
define void @sink_non_consecutive() !dbg !14 {
unreachable
}
define void @dont_sink_above_def() {
define void @dont_sink_above_def() !dbg !15 {
unreachable
}
define void @sink_to_same_place() {
define void @sink_to_same_place() !dbg !16 {
unreachable
}
define void @cannot_sink_across_same_variable() {
define void @cannot_sink_across_same_variable() !dbg !17 {
unreachable
}
define void @cannot_sink_across_same_variable2() {
define void @cannot_sink_across_same_variable2() !dbg !18 {
unreachable
}
define void @can_sink_across_same_variable_with_same_const() {
define void @can_sink_across_same_variable_with_same_const() !dbg !19 {
unreachable
}
define void @sink_multiple_defs() {
define void @sink_multiple_defs() !dbg !20 {
unreachable
}
define void @clone_same_bb() {
define void @clone_same_bb() !dbg !21 {
unreachable
}
define void @clone_different_bb() {
define void @clone_different_bb() !dbg !22 {
unreachable
}
define void @tee_with_two_use_insts() {
define void @tee_with_two_use_insts() !dbg !23 {
unreachable
}
define void @tee_with_one_inst_with_two_uses() {
define void @tee_with_one_inst_with_two_uses() !dbg !24 {
unreachable
}
declare void @llvm.dbg.value(metadata, metadata, metadata)
Expand Down Expand Up @@ -81,6 +81,17 @@
; CHECK: ![[VAR_C:[0-9]+]] = !DILocalVariable(name: "var_c"
!13 = !DILocalVariable(name: "var_d", scope: !6, file: !1, line: 2, type: !9)
; CHECK: ![[VAR_D:[0-9]+]] = !DILocalVariable(name: "var_d"
!14 = distinct !DISubprogram(name: "sink_non_consecutive", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!15 = distinct !DISubprogram(name: "dont_sink_above_def", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!16 = distinct !DISubprogram(name: "sink_to_same_place", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!17 = distinct !DISubprogram(name: "cannot_sink_across_same_variable", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!18 = distinct !DISubprogram(name: "cannot_sink_across_same_variable2", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!19 = distinct !DISubprogram(name: "can_sink_across_same_variable_with_same_const", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!20 = distinct !DISubprogram(name: "sink_multiple_defs", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!21 = distinct !DISubprogram(name: "clone_same_bb", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!22 = distinct !DISubprogram(name: "clone_different_bb", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!23 = distinct !DISubprogram(name: "tee_with_two_use_insts", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
!24 = distinct !DISubprogram(name: "tee_with_one_inst_with_two_uses", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, unit: !0)
...

---
Expand Down
18 changes: 9 additions & 9 deletions llvm/test/TableGen/DefaultOpsGlobalISel.td
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(1), /*SubOperand*/1, // mods1
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(1), /*SubOperand*/0, // src1
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 3,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 0: @79
Expand All @@ -73,8 +73,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/2, // clamp
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // omod
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 2,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 1: @139
Expand All @@ -95,8 +95,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // mods
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 8,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 2: @207
Expand All @@ -115,8 +115,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // omod
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 5,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 3: @265
Expand All @@ -141,8 +141,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 7,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 4: @345
Expand All @@ -160,8 +160,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 5: @400
Expand All @@ -180,8 +180,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/93,
// CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 6,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 6: @458
Expand All @@ -198,8 +198,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 1,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 7: @503
Expand All @@ -216,8 +216,8 @@ def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 4,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 8: @548
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // y
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ReplaceRegWithTempReg, /*OldInsnID*/0, /*OldOpIdx*/1, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 3: @525
// CHECK-NEXT: GIM_Reject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // b
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // c
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/1, /*Opcode*/GIMT_Encode2(TargetOpcode::G_ADD),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/1, /*OldInsnID*/0, /*OpIdx*/0, // a
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/1, /*OldInsnID*/0, /*OpIdx*/1, // b
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/1, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 0: @81
// CHECK-NEXT: GIM_Reject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 1: @99
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 2*/ GIMT_Encode4(199), // Rule ID 6 //
Expand Down Expand Up @@ -239,8 +239,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 2: @199
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 3*/ GIMT_Encode4(299), // Rule ID 5 //
Expand Down Expand Up @@ -282,8 +282,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 3: @299
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 4*/ GIMT_Encode4(409), // Rule ID 4 //
Expand Down Expand Up @@ -329,8 +329,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 4: @409
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4(509), // Rule ID 3 //
Expand Down Expand Up @@ -372,8 +372,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 5: @509
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4(619), // Rule ID 2 //
Expand Down Expand Up @@ -419,8 +419,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 6: @619
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4(729), // Rule ID 1 //
Expand Down Expand Up @@ -466,8 +466,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 7: @729
// CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4(849), // Rule ID 0 //
Expand Down Expand Up @@ -517,8 +517,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 8: @849
// CHECK-NEXT: GIM_Reject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def Test0 : GICombineRule<
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::G_CONSTANT),
// CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define),
// CHECK-NEXT: GIR_AddCImm, /*InsnID*/0, /*Type*/uint8_t(-2), /*Imm*/GIMT_Encode8(42),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/1, /*Opcode*/GIMT_Encode2(TargetOpcode::G_SUB),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/1, /*OldInsnID*/0, /*OpIdx*/0, // dst
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/1, /*TempRegID*/1,
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/1, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 0: @77
// CHECK-NEXT: GIM_Reject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def MyCombiner: GICombiner<"GenMyCombiner", [
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/1, // ext
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // ptr
// CHECK-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*NumInsns*/2, /*MergeInsnID's*/0, 1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_CustomAction, GIMT_Encode2(GICXXCustomAction_CombineApplyGICombiner2),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 10: @578
// CHECK-NEXT: GIM_Reject,
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitter-input-discard.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def FOO : I<(outs GPR32:$dst), (ins GPR32Op:$src0, GPR32Op:$src1), []>;
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// GISEL-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/3, // src1
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat <
(int_tgt_foo (i32 srcvalue), i32:$src1),
(FOO (IMPLICIT_DEF), GPR32:$src1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ def : Pat<(two_out GPR32:$val), (THREE_OUTS GPR32:$val)>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // DstI[out2]
// CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define|RegState::Dead),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // val
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitter-multiple-output.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ def : Pat<(two_in GPR32:$i1, GPR32:$i2), (TWO_INS GPR32:$i2, GPR32:$i1)>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // DstI[out2]
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/3, // i2
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // i1
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitter-nested-subregs.td
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def A0 : RegisterClass<"MyTarget", [i32], 32, (add a0)>;
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_AddTempSubRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(0), GIMT_Encode2(MyTarget::lo16),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(MyTarget::A0wRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(MyTarget::A0RegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat<(i16 (anyext i8:$src)),
(i16 (EXTRACT_SUBREG
(i32 (INSERT_SUBREG
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitter-output-discard.td
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def ADD_CO : I<(outs GPR32:$dst, GPR8:$flag),
// GISEL-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define|RegState::Dead),
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src1
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat <
(add i32:$src0, i32:$src1),
(ADD_CO GPR32:$src0, GPR32:$src1)
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitter-zero-reg.td
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def INST : PredI<(outs GPR32:$dst), (ins GPR32:$src), []>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src
// CHECK-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::NoRegister), /*AddRegisterRegFlags*/GIMT_Encode2(0),
// CHECK-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*NumInsns*/1, /*MergeInsnID's*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat<(i32 (load GPR32:$src)),
(INST GPR32:$src)>;
42 changes: 21 additions & 21 deletions llvm/test/TableGen/GlobalISelEmitter.td
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ def HasC : Predicate<"Subtarget->hasC()"> { let RecomputePerFunction = 1; }
// R19C-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // src2b
// R19C-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src2a
// R19C-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// R19C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R19C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R19C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R19C-NEXT: // GIR_Coverage, 20,
// R19C-NEXT: GIR_Done,
// R19C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -365,8 +365,8 @@ def : Pat<(select GPR32:$src1, (complex_rr GPR32:$src2a, GPR32:$src2b),
// R21C-NEXT: GIR_ComplexRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(1),
// R21C-NEXT: GIR_ComplexRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0),
// R21C-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*NumInsns*/1, /*MergeInsnID's*/0
// R21C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R21C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R21C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R21C-NEXT: // GIR_Coverage, 22,
// R21C-NEXT: GIR_Done,
// R21C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -414,8 +414,8 @@ def : Pat<(select GPR32:$src1, (complex_rr GPR32:$src2a, GPR32:$src2b),
// R20C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// R20C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// R20C-NEXT: GIR_ComplexRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0),
// R20C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R20C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R20C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R20C-NEXT: // GIR_Coverage, 21,
// R20C-NEXT: GIR_Done,
// R20C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -507,8 +507,8 @@ def : Pat<(frag GPR32:$src1, complex:$src2, complex:$src3),
// R00C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // src2
// R00C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/1, // src3
// R00C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/2, // src4
// R00C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R00C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R00C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R00C-NEXT: // GIR_Coverage, 0,
// R00C-NEXT: GIR_Done,
// R00C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -558,8 +558,8 @@ def INSNBOB : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2, GPR32:$src3, G
// R01C-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOV),
// R01C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// R01C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src1
// R01C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R01C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R01C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R01C-NEXT: // GIR_Coverage, 1,
// R01C-NEXT: GIR_Done,
// R01C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -607,8 +607,8 @@ def MOV : I<(outs GPR32:$dst), (ins GPR32:$src1),
// R02C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// R02C-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/uint8_t(-1),
// R02C-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// R02C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R02C-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// R02C-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// R02C-NEXT: // GIR_Coverage, 2,
// R02C-NEXT: GIR_Done,
// R02C-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -639,8 +639,8 @@ def XORI : I<(outs GPR32:$dst), (ins m1:$src2, GPR32:$src1),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::R0),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 3,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -669,8 +669,8 @@ def XOR : I<(outs GPR32:$dst), (ins Z:$src2, GPR32:$src1),
// NOOPT-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/uint8_t(-1),
// NOOPT-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::R0),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 4,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -700,8 +700,8 @@ def XORlike : I<(outs GPR32:$dst), (ins m1Z:$src2, GPR32:$src1),
// NOOPT-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::R0),
// NOOPT-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::R0),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 5,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -729,8 +729,8 @@ def XORManyDefaults : I<(outs GPR32:$dst), (ins m1Z:$src3, Z:$src2, GPR32:$src1)
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/13,
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 6,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -761,8 +761,8 @@ def XORIb : I<(outs GPR32:$dst), (ins mb:$src2, GPR32:$src1),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::R0),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // Wm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 23,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -802,8 +802,8 @@ def : Pat<(not GPR32:$Wm), (ORN R0, GPR32:$Wm)>;
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // src2
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src3
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 7,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -840,8 +840,8 @@ def : Pat<(not GPR32:$Wm), (ORN R0, GPR32:$Wm)>;
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // src2
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src3
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 28,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand All @@ -864,8 +864,8 @@ def MULADD : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2, GPR32:$src3),
// NOOPT-NEXT: // 1:{ *:[i32] } => (MOV1:{ *:[i32] })
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOV1),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 8,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand All @@ -887,8 +887,8 @@ def MOV1 : I<(outs GPR32:$dst), (ins), [(set GPR32:$dst, 1)]>;
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVimm8),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_CopyConstantAsSImm, /*NewInsnID*/0, /*OldInsnID*/0, // imm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 9,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand All @@ -911,8 +911,8 @@ def MOVimm8 : I<(outs GPR32:$dst), (ins i32imm:$imm), [(set GPR32:$dst, simm8:$i
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVimm9),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_CopyConstantAsSImm, /*NewInsnID*/0, /*OldInsnID*/0, // imm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 10,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand All @@ -935,8 +935,8 @@ def MOVimm9 : I<(outs GPR32:$dst), (ins i32imm:$imm), [(set GPR32:$dst, simm9:$i
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVcimm8),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_CustomRenderer, /*InsnID*/0, /*OldInsnID*/0, /*Renderer*/GIMT_Encode2(GICR_renderImm), // imm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 11,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand All @@ -958,8 +958,8 @@ def MOVcimm8 : I<(outs GPR32:$dst), (ins i32imm:$imm), [(set GPR32:$dst, cimm8:$
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVfpimmz),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_CopyFConstantAsFPImm, /*NewInsnID*/0, /*OldInsnID*/0, // imm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 18,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -1074,8 +1074,8 @@ def ADD : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2),
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::DOUBLE),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 15,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -1153,8 +1153,8 @@ def : Pat<(add i32:$src1, i32:$src2),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src2
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src1
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 16,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down Expand Up @@ -1199,8 +1199,8 @@ def : Pat<(i32 (bitconvert FPR32:$src1)),
// NOOPT-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MOVimm),
// NOOPT-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// NOOPT-NEXT: GIR_CopyConstantAsSImm, /*NewInsnID*/0, /*OldInsnID*/0, // imm
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// NOOPT-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// NOOPT-NEXT: // GIR_Coverage, 17,
// NOOPT-NEXT: GIR_Done,
// NOOPT-NEXT: // Label [[LABEL_NUM]]: @[[LABEL]]
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitterMatchTableOptimizer.td
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def LOAD16Imm : I<(outs GPR16:$dst), (ins GPR16:$src), []>;
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/1, // src
// CHECK-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*NumInsns*/2, /*MergeInsnID's*/0, 1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 3,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label [[L2_ID]]: @[[L2_AT]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def InstThreeOperands : I<(outs GPR32:$dst), (ins GPR32:$cond, GPR32:$src,GPR32:
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // cond
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/1, // src1
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/2, // src2
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 1,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 2: @126
Expand All @@ -65,8 +65,8 @@ def InstThreeOperands : I<(outs GPR32:$dst), (ins GPR32:$cond, GPR32:$src,GPR32:
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/1, /*OpIdx*/2, // cond
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/1, // src1
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/2, /*OpIdx*/2, // src2
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: // GIR_Coverage, 2,
// CHECK-NEXT: GIR_Done,
// CHECK-NEXT: // Label 3: @216
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/TableGen/GlobalISelEmitterRegSequence.td
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def SUBSOME_INSN : I<(outs SRegs:$dst), (ins SOP:$src), []>;
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*SubRegIndex*/1,
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/1,
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*SubRegIndex*/2,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/3, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat<(i32 (sext SOP:$src)),
(REG_SEQUENCE DRegs, (SUBSOME_INSN SOP:$src), sub0,
(SUBSOME_INSN SOP:$src), sub1)>;
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/TableGen/GlobalISelEmitterSubreg.td
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def : Pat<(sub (complex DOP:$src1, DOP:$src2), 77),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,

// Test that we import INSERT_SUBREG when its subregister source has a given
// class.
Expand All @@ -91,10 +91,10 @@ def : Pat<(i32 (anyext i16:$src)), (INSERT_SUBREG (i32 (IMPLICIT_DEF)), SOP:$src
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/2, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,


// Test that we can import INSERT_SUBREG when it is a subinstruction of another
Expand All @@ -117,8 +117,8 @@ def : Pat<(i32 (anyext i16:$src)), (SOME_INSN (INSERT_SUBREG (i32 (IMPLICIT_DEF)
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::SOME_INSN),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,


// Test that we correctly infer the super register class for INSERT_SUBREG when
Expand Down Expand Up @@ -149,10 +149,10 @@ def : Pat<(i32 (anyext i16:$src)), (INSERT_SUBREG (i32 (IMPLICIT_DEF)), (SUBSOME
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/1,
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/2, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,

// Test an EXTRACT_SUBREG that is a sub instruction. The individual
// operands should be constrained to specific register classes, and
Expand Down Expand Up @@ -184,9 +184,9 @@ def : Pat<(i16 (trunc (bitreverse DOP:$src))),
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_AddTempSubRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(0), GIMT_Encode2(sub0),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,

// EXTRACT_SUBREG is subinstruction, but also doesn't have a leaf input

Expand All @@ -209,8 +209,8 @@ def : Pat<(i16 (trunc (bitreverse DOP:$src))),
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::SUBSOME_INSN2),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def : Pat<(i16 (trunc (ctpop DOP:$src))),
(SUBSOME_INSN2 (EXTRACT_SUBREG (SOME_INSN DOP:$src), sub0))>;

Expand All @@ -221,9 +221,9 @@ def : Pat<(i16 (trunc DOP:$src)),
// CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
// CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// CHECK-NEXT: GIR_CopySubReg, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, /*SubRegIdx*/GIMT_Encode2(1), // src
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/1, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,


// Test that we can import SUBREG_TO_REG
Expand All @@ -240,6 +240,6 @@ def : Pat<(i32 (zext SOP:$src)),
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
// CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
// CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/1,
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/0, GIMT_Encode2(Test::DRegsRegClassID),
// CHECK-NEXT: GIR_ConstrainOperandRC, /*InsnID*/0, /*Op*/2, GIMT_Encode2(Test::SRegsRegClassID),
// CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
2 changes: 1 addition & 1 deletion llvm/test/TableGen/HasNoUse.td
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def NO_RET_ATOMIC_ADD : I<(outs), (ins GPR32Op:$src0, GPR32Op:$src1), []>;
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/2, // src1
// GISEL-NEXT: GIR_MergeMemOperands, /*InsnID*/0, /*NumInsns*/1, /*MergeInsnID's*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
let HasNoUse = true in
defm atomic_load_add_no_ret : binary_atomic_op<atomic_load_add>;

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/TableGen/gisel-physreg-input.td
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class I<dag OOps, dag IOps, list<dag> Pat>
// GISEL-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::ADD_PHYS),
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def ADD_PHYS : I<(outs GPR32:$dst), (ins GPR32:$src0),
[(set GPR32:$dst, (add GPR32:$src0, SPECIAL))]> {
let Uses = [SPECIAL];
Expand All @@ -71,8 +71,8 @@ def ADD_PHYS : I<(outs GPR32:$dst), (ins GPR32:$src0),
// GISEL-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::MUL_PHYS),
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
// GISEL-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // SPECIAL
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
// GISEL-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
// GISEL-NEXT: GIR_EraseFromParent, /*InsnID*/0,
def MUL_PHYS : I<(outs GPR32:$dst), (ins GPR32:$SPECIAL),
[(set GPR32:$dst, (mul GPR32:$SPECIAL, SPECIAL))]> {
let Uses = [SPECIAL];
Expand Down
45 changes: 0 additions & 45 deletions llvm/test/Transforms/InstCombine/cast_ptr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -113,51 +113,6 @@ define i1 @test4(i32 %A) {
ret i1 %C
}

define i1 @test4_icmp_with_var(i32 %A1, i32 %A2) {
; CHECK-LABEL: @test4_icmp_with_var(
; CHECK-NEXT: [[C:%.*]] = icmp ugt i32 [[A1:%.*]], [[A2:%.*]]
; CHECK-NEXT: ret i1 [[C]]
;
%B1 = inttoptr i32 %A1 to ptr
%B2 = inttoptr i32 %A2 to ptr
%C = icmp ugt ptr %B1, %B2
ret i1 %C
}

define i1 @test4_cmp_with_nonnull_constant(i32 %A) {
; CHECK-LABEL: @test4_cmp_with_nonnull_constant(
; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[A:%.*]], 1
; CHECK-NEXT: ret i1 [[C]]
;
%B = inttoptr i32 %A to ptr
%C = icmp eq ptr %B, inttoptr (i32 1 to ptr)
ret i1 %C
}

define i1 @test4_cmp_eq_0_or_1(i32 %x) {
; CHECK-LABEL: @test4_cmp_eq_0_or_1(
; CHECK-NEXT: [[OR:%.*]] = icmp ult i32 [[X:%.*]], 2
; CHECK-NEXT: ret i1 [[OR]]
;
%cast = inttoptr i32 %x to ptr
%tobool = icmp eq i32 %x, 0
%cmp = icmp eq ptr %cast, inttoptr (i32 1 to ptr)
%or = or i1 %tobool, %cmp
ret i1 %or
}

define i1 @test4_icmp_with_var_mismatched_type(i32 %A1, i64 %A2) {
; CHECK-LABEL: @test4_icmp_with_var_mismatched_type(
; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[A2:%.*]] to i32
; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[TMP1]], [[A1:%.*]]
; CHECK-NEXT: ret i1 [[C]]
;
%B1 = inttoptr i32 %A1 to ptr
%B2 = inttoptr i64 %A2 to ptr
%C = icmp ugt ptr %B1, %B2
ret i1 %C
}

define i1 @test4_as2(i16 %A) {
; CHECK-LABEL: @test4_as2(
; CHECK-NEXT: [[C:%.*]] = icmp eq i16 [[A:%.*]], 0
Expand Down
40 changes: 40 additions & 0 deletions llvm/test/Transforms/LoopVectorize/cast-induction.ll
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,43 @@ loop:
exit:
ret void
}


define void @cast_variable_step(i64 %step) {
; VF4-LABEL: @cast_variable_step(
; VF4-LABEL: vector.body:
; VF4: [[VEC_IND:%.+]] = phi <4 x i32>
; VF4: store <4 x i32> [[VEC_IND]]
; VF4: middle.block:
;
; IC2-LABEL: @cast_variable_step(
; IC2-LABEL: vector.body:
; IC2-NEXT: [[INDEX:%.+]] = phi i64 [ 0, %vector.ph ]
; IC2-NEXT: [[MUL:%.+]] = mul i64 %index, %step
; IC2-NEXT: [[OFFSET_IDX:%.+]] = add i64 10, [[MUL]]
; IC2-NEXT: [[TRUNC_OFF:%.+]] = trunc i64 [[OFFSET_IDX]] to i32
; IC2-NEXT: [[TRUNC_STEP:%.+]] = trunc i64 %step to i32
; IC2-NEXT: [[STEP0:%.+]] = mul i32 0, [[TRUNC_STEP]]
; IC2-NEXT: [[T0:%.+]] = add i32 [[TRUNC_OFF]], [[STEP0]]
; IC2-NEXT: [[STEP1:%.+]] = mul i32 1, [[TRUNC_STEP]]
; IC2-NEXT: [[T1:%.+]] = add i32 [[TRUNC_OFF]], [[STEP1]]
; IC2: store i32 [[T0]],
; IC2-NEXT: store i32 [[T1]],
;
entry:
br label %loop

loop:
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
%iv.2 = phi i64 [ 10, %entry ], [ %iv.2.next, %loop ]
%gep = getelementptr inbounds [2048 x i32], ptr @a, i64 0, i64 %iv
%iv.2.trunc = trunc i64 %iv.2 to i32
store i32 %iv.2.trunc, ptr %gep, align 4
%iv.next = add i64 %iv, 1
%iv.2.next = add i64 %iv.2, %step
%exitcond = icmp eq i64 %iv.next, 1024
br i1 %exitcond, label %exit, label %loop

exit:
ret void
}
10 changes: 3 additions & 7 deletions llvm/tools/llvm-jitlink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ add_llvm_tool(llvm-jitlink
llvm-jitlink-statistics.cpp
)

if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(llvm-jitlink PRIVATE network)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket nsl)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket)
endif()

export_executable_symbols(llvm-jitlink)
8 changes: 0 additions & 8 deletions llvm/tools/llvm-jitlink/llvm-jitlink-executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@ add_llvm_utility(llvm-jitlink-executor
intrinsics_gen
)

if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(llvm-jitlink-executor PRIVATE network)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink-executor PRIVATE socket)
endif()

export_executable_symbols(llvm-jitlink-executor)
2 changes: 2 additions & 0 deletions llvm/unittests/MIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ set(LLVM_LINK_COMPONENTS
FileCheck
MC
MIRParser
Passes
Support
Target
TargetParser
)

add_llvm_unittest(MIRTests
MachineMetadata.cpp
PassBuilderCallbacksTest.cpp
)

target_link_libraries(MIRTests PRIVATE LLVMTestingSupport)
Loading