[LLVMdev] How to get Alias Set Information?

Qiuping Yi yiqiuping at gmail.com
Thu Jan 29 04:51:00 PST 2015


Hi, all

I know LLVM has including several implementation of alias anlaysis. Now I
want to get the conservative alias set information, or maybe alias set
information.
I print the alias result through command " opt -print-alias-sets -biasicaa
.... ",
and I found the basic alias analysis does't consider the global values, so
if I want to get the maybe alias set information of all variables including
global variabels,
which alias analysis pass is better for me?

In addition, should I get the alias set information through AliasSetTracker?
Now, I am trying to use AliasSetTracker with Basic Alias Analysis as
follow:

PassManager pm;
pm.add(...); // add other passes
aliasInfo = createBasicAliasAnalysisPass();
pm.add(aliasInfo);
pm.run(*module);
aliasTracker = new AliasSetTracker(aliasInfo->getAnalysis<AliasAnalysis>());

// For testing this implementation, I using the next code to print the
alias set by
// simulating the code in AliasSetPrinter.

for (Module::iterator MIt = module->begin(); MIt != module->end(); ++MIt) {
    for (Function::iterator FIt = MIt->begin(); FIt != MIt->end(); ++FIt) {
        for (BasicBlock::iterator BIt = FIt->begin(); BIt != FIt->end();
++BIt) {
            aliasTracker->add(&*BIt);  //***
        }
    }
    aliasTracker->print()
}

However, the program crushed at line "***" with the next backtrace
information.
So how should I correctly get the alias set information?

0  klee            0x0000000000edc9af
1  klee            0x0000000000edceb9
2  libpthread.so.0 0x00007f2da192bcb0
3  klee            0x0000000000ce327f
llvm::AliasSet::aliasesPointer(llvm::Value const*, unsigned long,
llvm::MDNode const*, llvm::AliasAnalysis&) const + 95
4  klee            0x0000000000ce73d7
llvm::AliasSetTracker::findAliasSetForPointer(llvm::Value const*, unsigned
long, llvm::MDNode const*) + 167
5  klee            0x0000000000ce865a
llvm::AliasSetTracker::getAliasSetForPointer(llvm::Value*, unsigned long,
llvm::MDNode const*, bool*) + 3562
6  klee            0x0000000000ce8b58
llvm::AliasSetTracker::add(llvm::LoadInst*) + 200
7  klee            0x00000000006480fd klee::Executor::printAliasSet() + 125
8  klee            0x000000000067744e
klee::Executor::run(klee::ExecutionState&) + 878
9  klee            0x00000000006793ce
klee::Executor::runFunctionAsMain(llvm::Function*, int, char**, char**,
std::vector<int, std::allocator<int> >) + 2446
10 klee            0x0000000000635356 main + 10774
11 libc.so.6       0x00007f2da0b6776d __libc_start_main + 237
12 klee            0x00000000006408f1
Command terminated by signal 11

Thank you all in advance!

--------------------------------------------
Qiuping Yi
Institute Of Software
Chinese Academy of Sciences
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150129/98cacfc9/attachment.html>


More information about the llvm-dev mailing list