[llvm-dev] LibCallAliasAnalysis class instantiation parameter

Chris Chrulski via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 6 09:04:26 PDT 2015


Hello,

[sorry for the duplicate post, attempting to fix the formatting of the previous post]

Can anybody tell me the intent of the LibCallAliasAnalysis class? I see that to instantiate it, it requires a class derived from the pure virtual class LibCallInfo, but I cannot find any classes in the source tree that derive from LibCallInfo. Is this derived class intended to be supplied from a compiler front-end, library writer, or the llvm backend?

I was looking at a case similar to the following:

              #include <math.h>

     double x[1000], y[1000];
     double angle;

     void rotate(int point_count) {
        int i;

            for (i=0; i < point_count; i++) {
                    double tmp_x = x[i];
             x[i] = tmp_x * cos(angle) - y[i] * sin(angle);
                    y[i] = y[i] * cos(angle) + tmp_x * sin(angle);
         }
     }

In this case, the queries done by getModRefInfo are unable to avoid loading the ‘angle’ variable from memory for each call to sin/cos. Based on the comments in LibCallSemantics.h, it appears that LibCallAliasAnalysis should be able to handle this case by recognizing that sin/cos only affect errno. However, I don’t see any way of enabling this analysis without an appropriate derivation of LibCallInfo. Does anybody have info related to this?

Thanks,
Chris


More information about the llvm-dev mailing list