[LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass

Nick Lewycky nicholas at mxc.ca
Wed Nov 16 19:21:28 PST 2011


Never create a Twine as a local variable.

   V->setName(Twine("new_name"));

should work fine, however. Note that Twine itself has an implicit 
constructor from const char *, so this code:

   V->setName("new_name");

should also work fine.

Nick

Ryan Taylor wrote:
> Basically I have two separate passes (first is a loop pass) which are
> two different files and two different opts but I need to keep the data
> consistent (ie, I want the changes to show up the resulting .bc output
> file from the first (loop) pass so the second pass can use these new
> names. Currently, when I print out "BB->getName().str()" after the code
> below, I get the correct renaming but this doesn't show up in the output
> file.
>
> I'm calling the opt like this:
>
> opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll
>
> I have also tried:
>
> opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc
>
> Thanks.
>
> ---------- Forwarded message ----------
> From: *Ryan Taylor* <ryta1203 at gmail.com <mailto:ryta1203 at gmail.com>>
> Date: Wed, Nov 16, 2011 at 5:23 PM
> Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
> To: llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>
>
>
> LLVMers,
>
>    So, I'm trying to write a pass that changes the names of the basic
> blocks through the use of Value, so:
>
>    Value *V = *BasicBlockPtr;
>    const Twine Tname("new_name");
>    V->setName(Tname);
>
> But when I run the opt and look at the IR output nothing is changed? Not
> sure what I'm doing wrong.
>
> Thanks.
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list