summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2015-10-09 18:06:13 +0000
committerOwen Anderson <resistor@mac.com>2015-10-09 18:06:13 +0000
commitd95b08a0a72ef47268b94738360c9319dcdc4772 (patch)
treed54e64de26d1882bfd24227d20d92290cff4a0cb
parentc7b054a60cc1dc5c972b29ee694e7bbf8d186d22 (diff)
downloadbcm5719-llvm-d95b08a0a72ef47268b94738360c9319dcdc4772.tar.gz
bcm5719-llvm-d95b08a0a72ef47268b94738360c9319dcdc4772.zip
Refine the definition of convergent to only disallow the addition of new control dependencies.
This covers the common case of operations that cannot be sunk. Operations that cannot be hoisted should already be handled properly via the safe-to-speculate rules and mechanisms. llvm-svn: 249865
-rw-r--r--llvm/docs/LangRef.rst6
-rw-r--r--llvm/include/llvm/CodeGen/MachineInstr.h4
-rw-r--r--llvm/include/llvm/IR/Intrinsics.td4
-rw-r--r--llvm/include/llvm/MC/MCInstrDesc.h4
-rw-r--r--llvm/lib/CodeGen/MachineSink.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/Sink.cpp3
6 files changed, 12 insertions, 12 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index bc4df058646..a2eedfac952 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1219,10 +1219,8 @@ example:
``convergent``
This attribute indicates that the callee is dependent on a convergent
thread execution pattern under certain parallel execution models.
- Transformations that are execution model agnostic may only move or
- tranform this call if the final location is control equivalent to its
- original position in the program, where control equivalence is defined as
- A dominates B and B post-dominates A, or vice versa.
+ Transformations that are execution model agnostic may not make the execution
+ of a convergent operation control dependent on any additional values.
``inlinehint``
This attribute indicates that the source code contained a hint that
inlining this function is desirable (such as the "inline" keyword in
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 5d75e91c239..44bc2508166 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -497,8 +497,8 @@ public:
}
/// Return true if this instruction is convergent.
- /// Convergent instructions can only be moved to locations that are
- /// control-equivalent to their initial position.
+ /// Convergent instructions can not be made control-dependent on any
+ /// additional values.
bool isConvergent(QueryType Type = AnyInBundle) const {
return hasProperty(MCID::Convergent, Type);
}
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 2b77e58ca77..d40390ed3b4 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -73,8 +73,8 @@ def IntrNoReturn : IntrinsicProperty;
// Parallels the noduplicate attribute on LLVM IR functions.
def IntrNoDuplicate : IntrinsicProperty;
-// IntrConvergent - Calls to this intrinsic are convergent and may only be
-// moved to control equivalent blocks.
+// IntrConvergent - Calls to this intrinsic are convergent and may not be made
+// control-dependent on any additional values.
// Parallels the convergent attribute on LLVM IR functions.
def IntrConvergent : IntrinsicProperty;
diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h
index 6a582e82d00..1baf82ee5c4 100644
--- a/llvm/include/llvm/MC/MCInstrDesc.h
+++ b/llvm/include/llvm/MC/MCInstrDesc.h
@@ -336,8 +336,8 @@ public:
/// \brief Return true if this instruction is convergent.
///
- /// Convergent instructions may only be moved to locations that are
- /// control-equivalent to their original positions.
+ /// Convergent instructions may not be made control-dependent on any
+ /// additional values.
bool isConvergent() const { return Flags & (1 << MCID::Convergent); }
//===--------------------------------------------------------------------===//
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index aa1b091b556..5e6d6190c63 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -686,7 +686,8 @@ bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore,
if (!MI->isSafeToMove(AA, SawStore))
return false;
- // Convergent operations may only be moved to control equivalent locations.
+ // Convergent operations may not be made control-dependent on additional
+ // values.
if (MI->isConvergent())
return false;
diff --git a/llvm/lib/Transforms/Scalar/Sink.cpp b/llvm/lib/Transforms/Scalar/Sink.cpp
index adc53b17bdf..17a6858a0c0 100644
--- a/llvm/lib/Transforms/Scalar/Sink.cpp
+++ b/llvm/lib/Transforms/Scalar/Sink.cpp
@@ -172,7 +172,8 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis *AA,
if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst))
return false;
- // Convergent operations can only be moved to control equivalent blocks.
+ // Convergent operations cannot be made control-dependent on additional
+ // values.
if (auto CS = CallSite(Inst)) {
if (CS.hasFnAttr(Attribute::Convergent))
return false;
OpenPOWER on IntegriCloud