C++ llvm中的内存合并分析

C++ llvm中的内存合并分析,c++,llvm,static-analysis,llvm-ir,C++,Llvm,Static Analysis,Llvm Ir,我正在尝试使用LLVM分析过程对程序执行合并分析 基本上,我需要研究数组访问,并找出内存访问是否可以合并,也就是说,访问表达式对于归纳变量是否是单调的 我面临以下问题。数组访问以LLVM IR中的getelementptr指令表示。如何从那里重建表达式 如果不能使用静态分析,我也愿意执行动态分析 如果有帮助,我将尝试实现以下算法: procedure getCoalescingFactor(f, warpSize, reqLineSize) x ← the variable that c

我正在尝试使用LLVM分析过程对程序执行合并分析

基本上,我需要研究数组访问,并找出内存访问是否可以合并,也就是说,访问表达式对于归纳变量是否是单调的

我面临以下问题。数组访问以LLVM IR中的getelementptr指令表示。如何从那里重建表达式

如果不能使用静态分析,我也愿意执行动态分析

如果有帮助,我将尝试实现以下算法:

procedure getCoalescingFactor(f, warpSize, reqLineSize)
    x ← the variable that corresponds to the x grid coordinate
    fw ← f where all variables are fixed except x grid coordinate
    mono ← monotonicity(fw , x)
    if mono is unknown then
        culprits ← variables in fw which do not have a sign
        fw ← fw where each variable in culprits is assumed positive
        mono ← monotonicity(fw , x)
    end if
    if mono is monotonic then
        if mono is increasing then
            size ← f (x + warpSize) − f (x)
        else
            size ← f (x) − f (x + warpSize)
        end if
        return reqLineSize
    else
       offsets ← [fw (x), fw (x + 1), . . . , fw (x + warpSize)]
       uniqOffsets ← removeDuplicates(offsets)
       return size(uniqOffsets)
    end if
end procedure