Refine the definition of convergent to only disallow the addition of new control...
authorOwen Anderson <resistor@mac.com>
Fri, 9 Oct 2015 18:06:13 +0000 (18:06 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 9 Oct 2015 18:06:13 +0000 (18:06 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249865 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LangRef.rst
include/llvm/CodeGen/MachineInstr.h
include/llvm/IR/Intrinsics.td
include/llvm/MC/MCInstrDesc.h
lib/CodeGen/MachineSink.cpp
lib/Transforms/Scalar/Sink.cpp

index bc4df0586460e654b5998e04b98a1daf14c6069b..a2eedfac952d44de5422657da2334431f923c6ba 100644 (file)
@@ -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
index 5d75e91c239c81fb3845a86acd959d3b7c434945..44bc250816676adad70b68e3cc088f97cd4c5327 100644 (file)
@@ -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);
   }
index 2b77e58ca7791bc57970799d6ea92f84546f2561..d40390ed3b4464d8ca6857995ef09ce1b4cb6d4c 100644 (file)
@@ -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;
 
index 6a582e82d00e652482d4c0fe253d85ab0d91487f..1baf82ee5c453babb8fabc6fd6098990752ce993 100644 (file)
@@ -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); }
 
   //===--------------------------------------------------------------------===//
index aa1b091b556ee98facfea84a2911b42371537080..5e6d6190c6387382159002ea2ac9326f3cf17b52 100644 (file)
@@ -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;
 
index adc53b17bdf925c3a6606fe35ba593b0af9cb528..17a6858a0c00a1eb97e956e0f5d4d3dfe9684f8a 100644 (file)
@@ -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;