AliasAnalysis and memory dependency

Hi all,

I want to find memory dependency between CallInst instruction and other. So i used the following code:

AliasAnalysis &AA=getAnalysis();

if(isa(inst1)){

if(isa(inst2)){

CallInst *call_inst2= dyn_cast(inst2);

if(AA.getModRefInfo(inst1,call_inst2)==mod){

//

}

}

}

but i get the following error. I should what do for exrtact memory dependency between CallInst instruction and other.

Hi neda 8664,

I want to find memory dependency between CallInst instruction and other. So i
used the following code:

/ AliasAnalysis &AA=getAnalysis<AliasAnalysis>();/

/*if* (isa< StoreInst >(inst1)){ /

// // /*if* (isa<CallInst>(inst2)) / /{/

/ CallInst *call_inst2= dyn_cast<CallInst>(inst2); /

/*if* (AA.getModRefInfo(inst1,call_inst2)==mod) / /{/

/ ///

/ } /

/ }/

/ }/

but i get the following error. I should what do for exrtact memory dependency
between CallInst instruction and other.

you forgot to include the error.

Ciao, Duncan.

i am sorry,
i get this error:

opt: /home/llvm/src/include/llvm/Support/CallSite.h:87: ValTy* llvm::CallSiteBase<FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy>::getCalledValue() const [with FunTy = const llvm::Function, ValTy = const llvm::Value, UserTy = const llvm::User, InstrTy = const llvm::Instruction, CallTy = const llvm::CallInst, InvokeTy = const llvm::InvokeInst, IterTy = const llvm::Use*]: Assertion `getInstruction() && “Not a call or invoke instruction!”’ failed.

0 opt 0x08537540
1 opt 0x08539a7c
2 libpthread.so.0 0x0080b878
3 libc.so.6 0x0069464a abort + 378
4 libc.so.6 0x0068bde8 __assert_fail + 248
5 opt 0x082b3063
6 opt 0x082b7cad llvm::AliasAnalysis::getModRefInfo(llvm::ImmutableCallSite, llvm::ImmutableCallSite) + 61
7 opt 0x082b22e4
8 parallel.so 0x04a5c7c6 parallel::buildDataGraph(llvm::Loop*) + 1542
9 parallel.so 0x04a54e24 parallel::runOnLoop(llvm::Loop*, llvm::LPPassManager&) + 452
10 opt 0x0831a124 llvm::LPPassManager::runOnFunction(llvm::Function&) + 1156
11 opt 0x084c3aa1 llvm::FPPassManager::runOnFunction(llvm::Function&) + 545
12 opt 0x084c3bb7 llvm::FPPassManager::runOnModule(llvm::Module&) + 87
13 opt 0x084c35c5 llvm::MPPassManager::runOnModule(llvm::Module&) + 517
14 opt 0x084c376b llvm::PassManagerImpl::run(llvm::Module&) + 171
15 opt 0x084c386d llvm::PassManager::run(llvm::Module&) + 45
16 opt 0x080ed5df main + 5295
17 libc.so.6 0x0067ecc6 __libc_start_main + 230
18 opt 0x080e2201
Stack dump:
0. Program arguments: opt -dse -lda -memdep -basicaa -libcall-aa -scev-aa -globalsmodref-aa -load /home/llvm/src/Release+Profile+Asserts/lib/parallel.so -parallel -dot-cfg obj.o -o out.o

  1. Running pass ‘Function Pass Manager’ on module ‘obj.o’.
  2. Running pass ‘Loop Pass Manager’ on function ‘@write_circulations
  3. Running pass ‘parallel World Pass’ on basic block ‘%bb17’

Hi neda 8664, I deleted your original message (and you didn't quote it in
yours), so I can't make a sensible comment, sorry. That said, the assertion
message seems rather clear: "Not a call or invoke instruction!".

Ciao, Duncan.