<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Arnold,<div><br></div><div>I am curious, what is wrong with splitting critical edges?</div><div><br></div><div>Is it related to the potential cost it will incurved or is it just something we do not want to do?</div><div><br></div><div>Thanks,</div><div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>

</div>
<br><div><div>On Sep 17, 2013, at 10:03 AM, Arnold Schwaighofer <<a href="mailto:aschwaighofer@apple.com">aschwaighofer@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Author: arnolds<br>Date: Tue Sep 17 12:03:29 2013<br>New Revision: 190871<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=190871&view=rev">http://llvm.org/viewvc/llvm-project?rev=190871&view=rev</a><br>Log:<br>SLPVectorizer: Don't vectorize phi nodes that use invoke values<br><br>We can't insert an insertelement after an invoke. We would have to split a<br>critical edge. So when we see a phi node that uses an invoke we just give up.<br><br><a href="radar://14990770">radar://14990770</a><br><br>Modified:<br>    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp<br>    llvm/trunk/test/Transforms/SLPVectorizer/X86/ordering.ll<br><br>Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp<br>URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=190871&r1=190870&r2=190871&view=diff<br>==============================================================================<br>--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)<br>+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Tue Sep 17 12:03:29 2013<br>@@ -639,6 +639,18 @@ void BoUpSLP::buildTree_rec(ArrayRef<Val<br>   switch (Opcode) {<br>     case Instruction::PHI: {<br>       PHINode *PH = dyn_cast<PHINode>(VL0);<br>+<br>+      // Check for terminator values (e.g. invoke).<br>+      for (unsigned j = 0; j < VL.size(); ++j)<br>+        for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {<br>+          TerminatorInst *Term = dyn_cast<TerminatorInst>(cast<PHINode>(VL[j])->getIncomingValue(i));<br>+          if (Term) {<br>+            DEBUG(dbgs() << "SLP: Need to swizzle PHINodes (TerminatorInst use).\n");<br>+            newTreeEntry(VL, false);<br>+            return;<br>+          }<br>+        }<br>+<br>       newTreeEntry(VL, true);<br>       DEBUG(dbgs() << "SLP: added a vector of PHINodes.\n");<br><br><br>Modified: llvm/trunk/test/Transforms/SLPVectorizer/X86/ordering.ll<br>URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/ordering.ll?rev=190871&r1=190870&r2=190871&view=diff<br>==============================================================================<br>--- llvm/trunk/test/Transforms/SLPVectorizer/X86/ordering.ll (original)<br>+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/ordering.ll Tue Sep 17 12:03:29 2013<br>@@ -17,3 +17,65 @@ entry:<br>   %cmp11 = fcmp olt double %add, 0.000000e+00<br>   ret void<br> }<br>+<br>+declare i8* @objc_msgSend(i8*, i8*, ...)<br>+declare i32 @personality_v0(...)<br>+<br>+define void @invoketest() {<br>+entry:<br>+  br i1 undef, label %cond.true, label %cond.false<br>+<br>+cond.true:<br>+  %call49 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef) <br>+          to label %cond.true54 unwind label %lpad<br>+<br>+cond.false:<br>+  %call51 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)<br>+          to label %cond.false57 unwind label %lpad<br>+<br>+cond.true54:<br>+  %call56 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef) <br>+          to label %cond.end60 unwind label %lpad<br>+<br>+cond.false57:<br>+  %call59 = invoke double bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to double (i8*, i8*)*)(i8* undef, i8* undef)<br>+          to label %cond.end60 unwind label %lpad<br>+<br>+; Make sure we don't vectorize these phis - they have invokes as inputs.<br>+<br>+; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s<br>+<br>+; CHECK-LABEL: invoketest<br>+<br>+; CHECK-LABEL: cond.end60<br>+; CHECK-NEXT-NOT: phi <2 x double><br>+; CHECK: insertelement<br>+; CHECK-LABEL: if.then63<br>+<br>+cond.end60:<br>+  %cond126 = phi double [ %call49, %cond.true54 ], [ %call51, %cond.false57 ]<br>+  %cond61 = phi double [ %call56, %cond.true54 ], [ %call59, %cond.false57 ]<br>+  br i1 undef, label %if.end98, label %if.then63<br>+<br>+if.then63:<br>+  %conv69 = fptrunc double undef to float<br>+  %conv70 = fpext float %conv69 to double<br>+  %div71 = fdiv double %cond126, %conv70<br>+  %conv78 = fptrunc double undef to float<br>+  %conv79 = fpext float %conv78 to double<br>+  %div80 = fdiv double %cond61, %conv79<br>+  br label %if.end98<br>+<br>+lpad:<br>+  %l = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @personality_v0 to i8*)<br>+          cleanup<br>+  resume { i8*, i32 } %l<br>+<br>+if.end98:<br>+  %dimensionsResult.sroa.0.0 = phi double [ %div71, %if.then63 ], [ %cond126, %cond.end60 ]<br>+  %dimensionsResult.sroa.6.0 = phi double [ %div80, %if.then63 ], [ %cond61, %cond.end60 ]<br>+  br label %if.end99<br>+<br>+if.end99:<br>+  ret void<br>+}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br>llvm-commits@cs.uiuc.edu<br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></body></html>