[LLVMdev] How to create new local variable

Duncan Sands baldrick at free.fr
Sat Feb 5 10:07:25 PST 2011


Hi Abhirup,

>       I want to implement a simple common sub expression pass in
> llvm2.8

the development version of LLVM gained exactly such a CSE pass, called
EarlyCSE.

  which demands replacing the uses of the redundant expressions
> with a temporary variable. So, to introduce new temporary variable I
> have inserted an AllocaInst (...) providing the name of the temporary
> and desired type. But whenever I am going to insert a LoadInst for
> that variable I am getting segmentation fault. It is telling that
> llvm::Value::setName(...) fails and that has something to do with
> llvm::ValueSymbolTable::createValueName(...) method. What should I do
> to insert the local variable?

I suggest you post the code you are using to do this.

Ciao, Duncan.



More information about the llvm-dev mailing list