Skip to content

Commit f010b1b

Browse files
committed
Revert "Restore "Implement convergence control in MIR using SelectionDAG (#71785)""
This reverts commit c7fdd8c. Reason: Broke the sanitizer buildbots. See the comments at #71785 for more information.
1 parent d052148 commit f010b1b

Some content is hidden

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

50 files changed

+161
-832
lines changed

llvm/include/llvm/ADT/GenericConvergenceVerifier.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ template <typename ContextT> class GenericConvergenceVerifier {
6060
NoConvergence
6161
} ConvergenceKind = NoConvergence;
6262

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

7369
static bool isInsideConvergentFunction(const InstructionT &I);
7470
static bool isConvergent(const InstructionT &I);
75-
static ConvOpKind getConvOp(const InstructionT &I);
76-
void checkConvergenceTokenProduced(const InstructionT &I);
7771
const InstructionT *findAndCheckConvergenceTokenUsed(const InstructionT &I);
7872

7973
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
@@ -1386,15 +1386,6 @@ enum NodeType {
13861386
#define BEGIN_REGISTER_VP_SDNODE(VPSDID, ...) VPSDID,
13871387
#include "llvm/IR/VPIntrinsics.def"
13881388

1389-
// The `llvm.experimental.convergence.*` intrinsics.
1390-
CONVERGENCECTRL_ANCHOR,
1391-
CONVERGENCECTRL_ENTRY,
1392-
CONVERGENCECTRL_LOOP,
1393-
// This does not correspond to any convergence control intrinsic. It used to
1394-
// glue a convergence control token to a convergent operation in the DAG,
1395-
// which is later translated to an implicit use in the MIR.
1396-
CONVERGENCECTRL_GLUE,
1397-
13981389
/// BUILTIN_OP_END - This must be the last enum value in this list.
13991390
/// The target-specific pre-isel opcode values start here.
14001391
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
@@ -4402,7 +4402,6 @@ class TargetLowering : public TargetLoweringBase {
44024402
SmallVector<ISD::InputArg, 32> Ins;
44034403
SmallVector<SDValue, 4> InVals;
44044404
const ConstantInt *CFIType = nullptr;
4405-
SDValue ConvergenceControlToken;
44064405

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

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

llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ void GenericConvergenceVerifier<ContextT>::visit(const BlockT &BB) {
6161

6262
template <class ContextT>
6363
void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
64-
ConvOpKind ConvOp = getConvOp(I);
65-
64+
auto ID = ContextT::getIntrinsicID(I);
6665
auto *TokenDef = findAndCheckConvergenceTokenUsed(I);
67-
switch (ConvOp) {
68-
case CONV_ENTRY:
66+
bool IsCtrlIntrinsic = true;
67+
68+
switch (ID) {
69+
case Intrinsic::experimental_convergence_entry:
6970
Check(isInsideConvergentFunction(I),
7071
"Entry intrinsic can occur only in a convergent function.",
7172
{Context.print(&I)});
@@ -77,13 +78,13 @@ void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
7778
"same basic block.",
7879
{Context.print(&I)});
7980
LLVM_FALLTHROUGH;
80-
case CONV_ANCHOR:
81+
case Intrinsic::experimental_convergence_anchor:
8182
Check(!TokenDef,
8283
"Entry or anchor intrinsic cannot have a convergencectrl token "
8384
"operand.",
8485
{Context.print(&I)});
8586
break;
86-
case CONV_LOOP:
87+
case Intrinsic::experimental_convergence_loop:
8788
Check(TokenDef, "Loop intrinsic must have a convergencectrl token operand.",
8889
{Context.print(&I)});
8990
Check(!SeenFirstConvOp,
@@ -92,16 +93,14 @@ void GenericConvergenceVerifier<ContextT>::visit(const InstructionT &I) {
9293
{Context.print(&I)});
9394
break;
9495
default:
96+
IsCtrlIntrinsic = false;
9597
break;
9698
}
9799

98-
if (ConvOp != CONV_NONE)
99-
checkConvergenceTokenProduced(I);
100-
101100
if (isConvergent(I))
102101
SeenFirstConvOp = true;
103102

104-
if (TokenDef || ConvOp != CONV_NONE) {
103+
if (TokenDef || IsCtrlIntrinsic) {
105104
Check(isConvergent(I),
106105
"Convergence control token can only be used in a convergent call.",
107106
{Context.print(&I)});
@@ -144,10 +143,6 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
144143

145144
auto checkToken = [&](const InstructionT *Token, const InstructionT *User,
146145
SmallVectorImpl<const InstructionT *> &LiveTokens) {
147-
Check(DT.dominates(Token->getParent(), User->getParent()),
148-
"Convergence control token must dominate all its uses.",
149-
{Context.print(Token), Context.print(User)});
150-
151146
Check(llvm::is_contained(LiveTokens, Token),
152147
"Convergence region is not well-nested.",
153148
{Context.print(Token), Context.print(User)});
@@ -166,7 +161,8 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
166161
return;
167162
}
168163

169-
Check(getConvOp(*User) == CONV_LOOP,
164+
Check(ContextT::getIntrinsicID(*User) ==
165+
Intrinsic::experimental_convergence_loop,
170166
"Convergence token used by an instruction other than "
171167
"llvm.experimental.convergence.loop in a cycle that does "
172168
"not contain the token's definition.",
@@ -203,7 +199,7 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
203199
for (auto &I : *BB) {
204200
if (auto *Token = Tokens.lookup(&I))
205201
checkToken(Token, &I, LiveTokens);
206-
if (getConvOp(I) != CONV_NONE)
202+
if (isConvergenceControlIntrinsic(ContextT::getIntrinsicID(I)))
207203
LiveTokens.push_back(&I);
208204
}
209205

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
@@ -789,16 +789,6 @@ def assertsext : SDNode<"ISD::AssertSext", SDT_assert>;
789789
def assertzext : SDNode<"ISD::AssertZext", SDT_assert>;
790790
def assertalign : SDNode<"ISD::AssertAlign", SDT_assert>;
791791

792-
def convergencectrl_anchor : SDNode<"ISD::CONVERGENCECTRL_ANCHOR",
793-
SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
794-
def convergencectrl_entry : SDNode<"ISD::CONVERGENCECTRL_ENTRY",
795-
SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
796-
def convergencectrl_loop : SDNode<"ISD::CONVERGENCECTRL_LOOP",
797-
SDTypeProfile<1, 1,
798-
[SDTCisVT<0,untyped>, SDTCisVT<1,untyped>]>>;
799-
def convergencectrl_glue : SDNode<"ISD::CONVERGENCECTRL_GLUE",
800-
SDTypeProfile<0, 1, [SDTCisVT<0, untyped>]>>;
801-
802792
//===----------------------------------------------------------------------===//
803793
// Selection DAG Condition Codes
804794

llvm/lib/CodeGen/CMakeLists.txt

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

llvm/lib/CodeGen/MachineConvergenceVerifier.cpp

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

0 commit comments

Comments
 (0)