Skip to content

Commit a2afcd5

Browse files
committed
Revert "Implement convergence control in MIR using SelectionDAG (#71785)"
This reverts commit 7988973. Encountered multiple buildbot failures.
1 parent b8ed69e commit a2afcd5

Some content is hidden

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

52 files changed

+162
-833
lines changed

llvm/include/llvm/ADT/GenericConvergenceVerifier.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ template <typename ContextT> class GenericConvergenceVerifier {
3232

3333
void initialize(raw_ostream *OS,
3434
function_ref<void(const Twine &Message)> FailureCB,
35-
const FunctionT &F, bool _IsSSA) {
35+
const FunctionT &F) {
3636
clear();
3737
this->OS = OS;
3838
this->FailureCB = FailureCB;
3939
Context = ContextT(&F);
40-
IsSSA = _IsSSA;
4140
}
4241

4342
void clear();
@@ -53,7 +52,6 @@ template <typename ContextT> class GenericConvergenceVerifier {
5352
DominatorTreeT *DT;
5453
CycleInfoT CI;
5554
ContextT Context;
56-
bool IsSSA;
5755

5856
/// Whether the current function has convergencectrl operand bundles.
5957
enum {
@@ -62,10 +60,6 @@ template <typename ContextT> class GenericConvergenceVerifier {
6260
NoConvergence
6361
} ConvergenceKind = NoConvergence;
6462

65-
/// The control token operation performed by a convergence control Intrinsic
66-
/// in LLVM IR, or by a CONVERGENCECTRL* instruction in MIR
67-
enum ConvOpKind { CONV_ANCHOR, CONV_ENTRY, CONV_LOOP, CONV_NONE };
68-
6963
// Cache token uses found so far. Note that we track the unique definitions
7064
// and not the token values.
7165
DenseMap<const InstructionT *, const InstructionT *> Tokens;
@@ -74,7 +68,6 @@ template <typename ContextT> class GenericConvergenceVerifier {
7468

7569
static bool isInsideConvergentFunction(const InstructionT &I);
7670
static bool isConvergent(const InstructionT &I);
77-
static ConvOpKind getConvOp(const InstructionT &I);
7871
const InstructionT *findAndCheckConvergenceTokenUsed(const InstructionT &I);
7972

8073
void reportFailure(const Twine &Message, ArrayRef<Printable> Values);

llvm/include/llvm/CodeGen/FunctionLoweringInfo.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,15 @@ class FunctionLoweringInfo {
215215

216216
Register CreateRegs(Type *Ty, bool isDivergent = false);
217217

218-
Register InitializeRegForValue(const Value *V);
218+
Register InitializeRegForValue(const Value *V) {
219+
// Tokens never live in vregs.
220+
if (V->getType()->isTokenTy())
221+
return 0;
222+
Register &R = ValueMap[V];
223+
assert(R == 0 && "Already initialized this value register!");
224+
assert(VirtReg2Value.empty());
225+
return R = CreateRegs(V);
226+
}
219227

220228
/// GetLiveOutRegInfo - Gets LiveOutInfo for a register, returning NULL if the
221229
/// register is a PHI destination and the PHI's LiveOutInfo is not valid.

llvm/include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,15 +1384,6 @@ enum NodeType {
13841384
#define BEGIN_REGISTER_VP_SDNODE(VPSDID, ...) VPSDID,
13851385
#include "llvm/IR/VPIntrinsics.def"
13861386

1387-
// The `llvm.experimental.convergence.*` intrinsics.
1388-
CONVERGENCECTRL_ANCHOR,
1389-
CONVERGENCECTRL_ENTRY,
1390-
CONVERGENCECTRL_LOOP,
1391-
// This does not correspond to any convergence control intrinsic. It used to
1392-
// glue a convergence control token to a convergent operation in the DAG,
1393-
// which is later translated to an implicit use in the MIR.
1394-
CONVERGENCECTRL_GLUE,
1395-
13961387
/// BUILTIN_OP_END - This must be the last enum value in this list.
13971388
/// The target-specific pre-isel opcode values start here.
13981389
BUILTIN_OP_END

llvm/include/llvm/CodeGen/MachineConvergenceVerifier.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

llvm/include/llvm/CodeGen/SelectionDAGISel.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,6 @@ class SelectionDAGISel : public MachineFunctionPass {
459459
void Select_ARITH_FENCE(SDNode *N);
460460
void Select_MEMBARRIER(SDNode *N);
461461

462-
void Select_CONVERGENCECTRL_ANCHOR(SDNode *N);
463-
void Select_CONVERGENCECTRL_ENTRY(SDNode *N);
464-
void Select_CONVERGENCECTRL_LOOP(SDNode *N);
465-
466462
void pushStackMapLiveVariable(SmallVectorImpl<SDValue> &Ops, SDValue Operand,
467463
SDLoc DL);
468464
void Select_STACKMAP(SDNode *N);

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,7 +4401,6 @@ class TargetLowering : public TargetLoweringBase {
44014401
SmallVector<ISD::InputArg, 32> Ins;
44024402
SmallVector<SDValue, 4> InVals;
44034403
const ConstantInt *CFIType = nullptr;
4404-
SDValue ConvergenceControlToken;
44054404

44064405
CallLoweringInfo(SelectionDAG &DAG)
44074406
: RetSExt(false), RetZExt(false), IsVarArg(false), IsInReg(false),
@@ -4535,11 +4534,6 @@ class TargetLowering : public TargetLoweringBase {
45354534
return *this;
45364535
}
45374536

4538-
CallLoweringInfo &setConvergenceControlToken(SDValue Token) {
4539-
ConvergenceControlToken = Token;
4540-
return *this;
4541-
}
4542-
45434537
ArgListTy &getArgs() {
45444538
return Args;
45454539
}

llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ template <class ContextT> void GenericConvergenceVerifier<ContextT>::clear() {
5252
Tokens.clear();
5353
CI.clear();
5454
ConvergenceKind = NoConvergence;
55-
IsSSA = false;
5655
}
5756

5857
template <class ContextT>
@@ -62,16 +61,12 @@ void GenericConvergenceVerifier<ContextT>::visit(const BlockT &BB) {
6261

6362
template <class ContextT>
6463
void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
65-
ConvOpKind ConvOp = getConvOp(I);
66-
if (!IsSSA) {
67-
Check(ConvOp == CONV_NONE, "Convergence control requires SSA.",
68-
{Context.print(&I)});
69-
return;
70-
}
64+
auto ID = ContextT::getIntrinsicID(I);
7165
auto *TokenDef = findAndCheckConvergenceTokenUsed(I);
66+
bool IsCtrlIntrinsic = true;
7267

73-
switch (ConvOp) {
74-
case CONV_ENTRY:
68+
switch (ID) {
69+
case Intrinsic::experimental_convergence_entry:
7570
Check(isInsideConvergentFunction(I),
7671
"Entry intrinsic can occur only in a convergent function.",
7772
{Context.print(&I)});
@@ -83,13 +78,13 @@ void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
8378
"same basic block.",
8479
{Context.print(&I)});
8580
LLVM_FALLTHROUGH;
86-
case CONV_ANCHOR:
81+
case Intrinsic::experimental_convergence_anchor:
8782
Check(!TokenDef,
8883
"Entry or anchor intrinsic cannot have a convergencectrl token "
8984
"operand.",
9085
{Context.print(&I)});
9186
break;
92-
case CONV_LOOP:
87+
case Intrinsic::experimental_convergence_loop:
9388
Check(TokenDef, "Loop intrinsic must have a convergencectrl token operand.",
9489
{Context.print(&I)});
9590
Check(!SeenFirstConvOp,
@@ -98,13 +93,14 @@ void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
9893
{Context.print(&I)});
9994
break;
10095
default:
96+
IsCtrlIntrinsic = false;
10197
break;
10298
}
10399

104100
if (isConvergent(I))
105101
SeenFirstConvOp = true;
106102

107-
if (TokenDef || ConvOp != CONV_NONE) {
103+
if (TokenDef || IsCtrlIntrinsic) {
108104
Check(isConvergent(I),
109105
"Convergence control token can only be used in a convergent call.",
110106
{Context.print(&I)});
@@ -165,7 +161,8 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
165161
return;
166162
}
167163

168-
Check(getConvOp(*User) == CONV_LOOP,
164+
Check(ContextT::getIntrinsicID(*User) ==
165+
Intrinsic::experimental_convergence_loop,
169166
"Convergence token used by an instruction other than "
170167
"llvm.experimental.convergence.loop in a cycle that does "
171168
"not contain the token's definition.",
@@ -202,7 +199,7 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
202199
for (auto &I : *BB) {
203200
if (auto *Token = Tokens.lookup(&I))
204201
checkToken(Token, &I, LiveTokens);
205-
if (getConvOp(I) != CONV_NONE)
202+
if (isConvergenceControlIntrinsic(ContextT::getIntrinsicID(I)))
206203
LiveTokens.push_back(&I);
207204
}
208205

llvm/include/llvm/Support/TargetOpcodes.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,6 @@ HANDLE_TARGET_OPCODE(MEMBARRIER)
225225
// using.
226226
HANDLE_TARGET_OPCODE(JUMP_TABLE_DEBUG_INFO)
227227

228-
HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ENTRY)
229-
HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ANCHOR)
230-
HANDLE_TARGET_OPCODE(CONVERGENCECTRL_LOOP)
231-
HANDLE_TARGET_OPCODE(CONVERGENCECTRL_GLUE)
232-
233228
/// The following generic opcodes are not supposed to appear after ISel.
234229
/// This is something we might want to relax, but for now, this is convenient
235230
/// to produce diagnostics.

llvm/include/llvm/Target/Target.td

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,25 +1483,6 @@ def JUMP_TABLE_DEBUG_INFO : StandardPseudoInstruction {
14831483
let isMeta = true;
14841484
}
14851485

1486-
let hasSideEffects = false, isMeta = true, isConvergent = true in {
1487-
def CONVERGENCECTRL_ANCHOR : StandardPseudoInstruction {
1488-
let OutOperandList = (outs unknown:$dst);
1489-
let InOperandList = (ins);
1490-
}
1491-
def CONVERGENCECTRL_ENTRY : StandardPseudoInstruction {
1492-
let OutOperandList = (outs unknown:$dst);
1493-
let InOperandList = (ins);
1494-
}
1495-
def CONVERGENCECTRL_LOOP : StandardPseudoInstruction {
1496-
let OutOperandList = (outs unknown:$dst);
1497-
let InOperandList = (ins unknown:$src);
1498-
}
1499-
def CONVERGENCECTRL_GLUE : StandardPseudoInstruction {
1500-
let OutOperandList = (outs);
1501-
let InOperandList = (ins unknown:$src);
1502-
}
1503-
}
1504-
15051486
// Generic opcodes used in GlobalISel.
15061487
include "llvm/Target/GenericOpcodes.td"
15071488

llvm/include/llvm/Target/TargetSelectionDAG.td

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -782,16 +782,6 @@ def assertsext : SDNode<"ISD::AssertSext", SDT_assert>;
782782
def assertzext : SDNode<"ISD::AssertZext", SDT_assert>;
783783
def assertalign : SDNode<"ISD::AssertAlign", SDT_assert>;
784784

785-
def convergencectrl_anchor : SDNode<"ISD::CONVERGENCECTRL_ANCHOR",
786-
SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
787-
def convergencectrl_entry : SDNode<"ISD::CONVERGENCECTRL_ENTRY",
788-
SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
789-
def convergencectrl_loop : SDNode<"ISD::CONVERGENCECTRL_LOOP",
790-
SDTypeProfile<1, 1,
791-
[SDTCisVT<0,untyped>, SDTCisVT<1,untyped>]>>;
792-
def convergencectrl_glue : SDNode<"ISD::CONVERGENCECTRL_GLUE",
793-
SDTypeProfile<0, 1, [SDTCisVT<0, untyped>]>>;
794-
795785
//===----------------------------------------------------------------------===//
796786
// Selection DAG Condition Codes
797787

llvm/lib/CodeGen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ add_llvm_component_library(LLVMCodeGen
109109
MachineBranchProbabilityInfo.cpp
110110
MachineCFGPrinter.cpp
111111
MachineCombiner.cpp
112-
MachineConvergenceVerifier.cpp
113112
MachineCopyPropagation.cpp
114113
MachineCSE.cpp
115114
MachineCheckDebugify.cpp

llvm/lib/CodeGen/MachineConvergenceVerifier.cpp

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)