[llvm-commits] [llvm] r75556 - in /llvm/trunk/lib/Target: CBackend/CBackend.cpp MSIL/MSILWriter.cpp MSIL/MSILWriter.h

Artur Pietrek pietreka at gmail.com
Wed Jul 15 04:07:37 PDT 2009


On Tue, Jul 14, 2009 at 1:46 AM, Chris Lattner <sabre at nondot.org> wrote:

> Author: lattner
> Date: Mon Jul 13 18:46:46 2009
> New Revision: 75556
>
> URL: http://llvm.org/viewvc/llvm-project?rev=75556&view=rev
> Log:
> fix CBE & MSIL backends to not use the mangler for non-global symbols.
>
> Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=75556&r1=75555&r2=75556&view=diff
>
>
> ==============================================================================
> --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original)
> +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Mon Jul 13 18:46:46 2009
> @@ -240,8 +240,17 @@
>
>
>  std::string MSILWriter::getValueName(const Value* V) {
> +  std::string Name;
> +  if (const GlobalValue *GV = cast<GlobalValue>(V))
> +    Name = Mang->getValueName(GV);
> +  else {
> +    unsigned &No = AnonValueNumbers[V];
> +    if (No == 0) No = ++NextAnonValueNumber;
> +    Name = "tmp" + utostr(No);
> +  }
> +
>   // Name into the quotes allow control and space characters.
> -  return "'"+Mang->getValueName(V)+"'";
> +  return "'"+Name+"'";
>  }
>
>
> @@ -258,7 +267,16 @@
>
>
>  std::string MSILWriter::getLabelName(const Value* V) {
> -  return getLabelName(Mang->getValueName(V));
> +  std::string Name;
> +  if (const GlobalValue *GV = cast<GlobalValue>(V))
> +    Name = Mang->getValueName(GV);
> +  else {
> +    unsigned &No = AnonValueNumbers[V];
> +    if (No == 0) No = ++NextAnonValueNumber;
> +    Name = "tmp" + utostr(No);
> +  }
> +
> +  return getLabelName(Name);
>  }
>
>
In both cases it should be dyn_cast not cast because it triggers assert if
Value is not a GlobalValue.
Patch attached.

Artur

P.S.
Should I submit bugs in bugzilla for such errors or replying for commit here
is enough?
Could someone add "Backend: MSIL" component in bugzilla?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090715/89b33d56/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cast_fixup.patch
Type: text/x-patch
Size: 804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090715/89b33d56/attachment.bin>


More information about the llvm-commits mailing list