[llvm-dev] IndVarSimplify: getBackedgeTakenCount and Release vs Assert

Jeroen Dobbelaere via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 5 09:45:37 PST 2020


Hi,

I am investigating a difference in code generation between release and assert builds of llvm.
The culprit is IndVarSimplify that comes up with different behavior on the same input:
 in the assertion build, it does do an extra 'INDVARS: Rewriting loop exit condition'

After digging around, it seems that following change is the culprit:

-----
Author: Philip Reames <listmail at philipreames.com>  2019-08-01 03:16:08
Committer: Philip Reames <listmail at philipreames.com>  2019-08-01 03:16:08

    Fix a release-only build warning triggered by rL367485
    
    llvm-svn: 367499


[..]


+#ifndef NDEBUG
+  // Used below for a consistency check only
   const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L);
+#endif
-----

It seems that the 'SE->getBackedgeTakenCount(L)' call has sideeffects.. Is that to be expected ?
Is the correct solution then to always keep the call ?

Thanks,

Jeroen Dobbelaere



More information about the llvm-dev mailing list