Generalize convergent check to handle invokes as well as calls.
authorOwen Anderson <resistor@mac.com>
Fri, 9 Oct 2015 20:17:46 +0000 (20:17 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 9 Oct 2015 20:17:46 +0000 (20:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249892 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnswitch.cpp

index 6d99caf1dff8bd87628fac41ef98f0bc7499c333..0f7ce7eb05236c160d129828e963974de6b9cc8c 100644 (file)
@@ -506,10 +506,10 @@ bool LoopUnswitch::processCurrentLoop() {
   // FIXME: This could be refined to only bail if the convergent operation is
   // not already control-dependent on the unswitch value.
   for (const auto BB : currentLoop->blocks()) {
   // FIXME: This could be refined to only bail if the convergent operation is
   // not already control-dependent on the unswitch value.
   for (const auto BB : currentLoop->blocks()) {
-    for (const auto &I : *BB) {
-      const auto CI = dyn_cast<CallInst>(&I);
-      if (!CI) continue;
-      if (CI->isConvergent())
+    for (auto &I : *BB) {
+      auto CS = CallSite(&I);
+      if (!CS) continue;
+      if (CS.hasFnAttr(Attribute::Convergent))
         return false;
     }
   }
         return false;
     }
   }