[PATCH] D103118: [SCEV] Compute exit counts for unsigned IVs using mustprogress semantics

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 13:18:55 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6499
+
+  // A loop without side effects must be finite.
+  // TODO: The check used here is very conservative.  It's only *specific*
----------------
mkazantsev wrote:
> Is this actually true? For C++, I was able to find that
> ```
> In a valid C++ program, every thread eventually does one of the following:
> 
> terminate
> makes a call to an I/O library function
> reads or modifies a volatile object [!!!]
> performs an atomic operation or a synchronization operation
> ```
> 
> Is it different in LLVM? A loop that only reads volatile memory is non-side-effecting, but I'd be surprised if we considered it finite.
A volatile read is considered a side effecting instruction, so the presence of a volatile load in the loop will be enough to prevent it from being considered presumed finite.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103118



More information about the llvm-commits mailing list