[PATCH] D153414: [LLVM] Do not speculate convergent calls

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 22:58:47 PDT 2023


sameerds abandoned this revision.
sameerds added a comment.

Abandoning. I agree with relying on attribute speculatable. If we figure out the conditions that make a convergent call speculatable, then at that time, we should use the appropriate attribute to record that fact. On the other hand, if speculation of a convergent call is dependent on the surrounding control flow, then we will probably have to do it as a separate optimization.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:6006-6012
+    if (CI->isConvergent())
+      return false;
 
     // The called function could have undefined behavior or side-effects, even
     // if marked readnone nounwind.
+    const Function *Callee = CI->getCalledFunction();
     return Callee && Callee->isSpeculatable();
----------------
arsenm wrote:
> Should go through the CallBase rather than separately checking the callee and call site attributes. Also you're missing invokes
Just below, all the other "call-like" instructions are simply assumed to be not safe for speculation. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153414/new/

https://reviews.llvm.org/D153414



More information about the llvm-commits mailing list