[LLVMdev] Question about PRE Pass

John Criswell criswell at cs.uiuc.edu
Mon Mar 9 13:14:05 PDT 2009


Dear All,

I'm getting the following assertion:

llvm-ld: /home/vadve/criswell/src/llvm22/lib/VMCore/Value.cpp:175: void
llvm::Value::setName(const char*, unsigned int): Assertion `getType() !=
Type::VoidTy && "Cannot assign a name to void values!"' failed.

It seems to be caused by the following line in
lib/Transforms/Scalar/GVN.cpp (line 1566):

PREInstr->setName(CurInst->getName() + ".pre");

The instruction that is being manipulated is:

call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind

The function (through optimization) doesn't do anything, so the analysis
knows that it does not read from or write to memory:

define internal fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev()
nounwind readnone {
entry:
        ret void
}

A simple fix would be to change the code to only assign a name if the
original instruction has a name.  However, would it make more sense to
simply have the code ignore instructions that return void (since if they
don't read or write memory, they must therefore have no effect)?

-- John T.




More information about the llvm-dev mailing list