[llvm] r274978 - Revert "AMDGPU: Remove unused control flow intrinsic"
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 9 10:18:39 PDT 2016
Author: arsenm
Date: Sat Jul 9 12:18:39 2016
New Revision: 274978
URL: http://llvm.org/viewvc/llvm-project?rev=274978&view=rev
Log:
Revert "AMDGPU: Remove unused control flow intrinsic"
Modified:
llvm/trunk/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
llvm/trunk/lib/Target/AMDGPU/SIFixControlFlowLiveIntervals.cpp
llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
llvm/trunk/lib/Target/AMDGPU/SIIntrinsics.td
llvm/trunk/lib/Target/AMDGPU/SILowerControlFlow.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp Sat Jul 9 12:18:39 2016
@@ -37,6 +37,7 @@ typedef SmallVector<StackEntry, 16> Stac
// Intrinsic names the control flow is annotated with
static const char *const IfIntrinsic = "llvm.amdgcn.if";
static const char *const ElseIntrinsic = "llvm.amdgcn.else";
+static const char *const BreakIntrinsic = "llvm.amdgcn.break";
static const char *const IfBreakIntrinsic = "llvm.amdgcn.if.break";
static const char *const ElseBreakIntrinsic = "llvm.amdgcn.else.break";
static const char *const LoopIntrinsic = "llvm.amdgcn.loop";
@@ -145,6 +146,9 @@ bool SIAnnotateControlFlow::doInitializa
Else = M.getOrInsertFunction(
ElseIntrinsic, ReturnStruct, Int64, (Type *)nullptr);
+ Break = M.getOrInsertFunction(
+ BreakIntrinsic, Int64, Int64, (Type *)nullptr);
+
IfBreak = M.getOrInsertFunction(
IfBreakIntrinsic, Int64, Boolean, Int64, (Type *)nullptr);
Modified: llvm/trunk/lib/Target/AMDGPU/SIFixControlFlowLiveIntervals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFixControlFlowLiveIntervals.cpp?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFixControlFlowLiveIntervals.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFixControlFlowLiveIntervals.cpp Sat Jul 9 12:18:39 2016
@@ -72,6 +72,7 @@ bool SIFixControlFlowLiveIntervals::runO
switch (MI.getOpcode()) {
case AMDGPU::SI_IF:
case AMDGPU::SI_ELSE:
+ case AMDGPU::SI_BREAK:
case AMDGPU::SI_IF_BREAK:
case AMDGPU::SI_ELSE_BREAK:
case AMDGPU::SI_END_CF: {
Modified: llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp Sat Jul 9 12:18:39 2016
@@ -324,6 +324,7 @@ bool SIFixSGPRCopies::runOnMachineFuncti
assert(DefInstr);
switch(DefInstr->getOpcode()) {
+ case AMDGPU::SI_BREAK:
case AMDGPU::SI_IF_BREAK:
case AMDGPU::SI_ELSE_BREAK:
// If we see a PHI instruction that defines an SGPR, then that PHI
Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Sat Jul 9 12:18:39 2016
@@ -1261,6 +1261,7 @@ bool SITargetLowering::isCFIntrinsic(con
default: return false;
case AMDGPUIntrinsic::amdgcn_if:
case AMDGPUIntrinsic::amdgcn_else:
+ case AMDGPUIntrinsic::amdgcn_break:
case AMDGPUIntrinsic::amdgcn_if_break:
case AMDGPUIntrinsic::amdgcn_else_break:
case AMDGPUIntrinsic::amdgcn_loop:
Modified: llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInstructions.td?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInstructions.td (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIInstructions.td Sat Jul 9 12:18:39 2016
@@ -1958,6 +1958,11 @@ def SI_LOOP : InstSI <
} // End isBranch = 1, isTerminator = 1
+def SI_BREAK : InstSI <
+ (outs SReg_64:$dst), (ins SReg_64:$src), "",
+ [(set i64:$dst, (int_amdgcn_break i64:$src))]
+>;
+
def SI_IF_BREAK : InstSI <
(outs SReg_64:$dst), (ins SReg_64:$vcc, SReg_64:$src), "",
[(set i64:$dst, (int_amdgcn_if_break i1:$vcc, i64:$src))]
Modified: llvm/trunk/lib/Target/AMDGPU/SIIntrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIIntrinsics.td?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIIntrinsics.td (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIIntrinsics.td Sat Jul 9 12:18:39 2016
@@ -181,6 +181,7 @@ let TargetPrefix = "amdgcn", isTarget =
def int_amdgcn_if : Intrinsic<[llvm_i64_ty], [llvm_i1_ty, llvm_empty_ty], []>;
def int_amdgcn_else : Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_empty_ty], []>;
+ def int_amdgcn_break : Intrinsic<[llvm_i64_ty], [llvm_i64_ty], []>;
def int_amdgcn_if_break : Intrinsic<[llvm_i64_ty], [llvm_i1_ty, llvm_i64_ty], []>;
def int_amdgcn_else_break : Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], []>;
def int_amdgcn_loop : Intrinsic<[], [llvm_i64_ty, llvm_empty_ty], []>;
Modified: llvm/trunk/lib/Target/AMDGPU/SILowerControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SILowerControlFlow.cpp?rev=274978&r1=274977&r2=274978&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SILowerControlFlow.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SILowerControlFlow.cpp Sat Jul 9 12:18:39 2016
@@ -80,6 +80,7 @@ private:
void If(MachineInstr &MI);
void Else(MachineInstr &MI, bool ExecModified);
+ void Break(MachineInstr &MI);
void IfBreak(MachineInstr &MI);
void ElseBreak(MachineInstr &MI);
void Loop(MachineInstr &MI);
@@ -276,6 +277,20 @@ void SILowerControlFlow::Else(MachineIns
MI.eraseFromParent();
}
+void SILowerControlFlow::Break(MachineInstr &MI) {
+ MachineBasicBlock &MBB = *MI.getParent();
+ DebugLoc DL = MI.getDebugLoc();
+
+ unsigned Dst = MI.getOperand(0).getReg();
+ unsigned Src = MI.getOperand(1).getReg();
+
+ BuildMI(MBB, &MI, DL, TII->get(AMDGPU::S_OR_B64), Dst)
+ .addReg(AMDGPU::EXEC)
+ .addReg(Src);
+
+ MI.eraseFromParent();
+}
+
void SILowerControlFlow::IfBreak(MachineInstr &MI) {
MachineBasicBlock &MBB = *MI.getParent();
DebugLoc DL = MI.getDebugLoc();
@@ -661,6 +676,10 @@ bool SILowerControlFlow::runOnMachineFun
Else(MI, ExecModified);
break;
+ case AMDGPU::SI_BREAK:
+ Break(MI);
+ break;
+
case AMDGPU::SI_IF_BREAK:
IfBreak(MI);
break;
More information about the llvm-commits
mailing list