[LLVMdev] StructReturnToPointer in poolalloc failing with LLVM 3.4

Zvonimir Rakamaric zvonimir at cs.utah.edu
Fri Mar 14 14:06:32 PDT 2014


Hi,

I've been happily using DSA in a project of mine for quite a while
now, and recently I noticed that the functionality of
StructReturnToPointer could be useful to me as well.

So I tried using it on a simple example, but I keep getting the
following exception:

smack: /home/zvonimir/projects/smack-project/llvm/src/lib/IR/Attributes.cpp:912:
unsigned int llvm::AttributeSet::getSlotIndex(unsigned int) const:
Assertion `pImpl && Slot < pImpl->getNumAttributes() && "Slot # out of
range!"' failed.
0  smack           0x0000000000a38982 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  smack           0x0000000000a37d69
2  libpthread.so.0 0x00007fc770d81cb0
3  libc.so.6       0x00007fc76fdab425 gsignal + 53
4  libc.so.6       0x00007fc76fdaeb8b abort + 379
5  libc.so.6       0x00007fc76fda40ee
6  libc.so.6       0x00007fc76fda4192
7  smack           0x000000000090164f
8  smack           0x000000000099a984
llvm::Argument::addAttr(llvm::AttributeSet) + 36
9  smack           0x000000000050f294
llvm::StructRet::runOnModule(llvm::Module&) + 2180
10 smack           0x00000000009c2e1f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 927
11 smack           0x000000000048d448 main + 840
12 libc.so.6       0x00007fc76fd9676d __libc_start_main + 237



Basically, there is a problem with the following piece of code, and I
suspect it might be due to upgrading to LLVM 3.4:
    ValueToValueMapTy ValueMap;
    Function::arg_iterator NI = NF->arg_begin();
    NI->setName("ret");
    ++NI;
    for (Function::arg_iterator II = F->arg_begin(); II !=
F->arg_end(); ++II, ++NI) {
      ValueMap[II] = NI;
      NI->setName(II->getName());
      NI->addAttr(F->getAttributes().getParamAttributes(II->getArgNo() + 1));
    }

I've tried to fix this, but no luck so far, and so help would be great
appreciated.

Thanks!

-- Zvonimir



More information about the llvm-dev mailing list