From 4570b3177c3b0f052362c16fd9411e2df32930fc Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 9 Oct 2015 20:17:46 +0000 Subject: [PATCH] Generalize convergent check to handle invokes as well as calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249892 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopUnswitch.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 6d99caf1dff..0f7ce7eb052 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -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()) { - for (const auto &I : *BB) { - const auto CI = dyn_cast(&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; } } -- 2.34.1