[patch][rfc] "alias weak" X "weak alias"

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Jun 4 23:33:23 PDT 2014


On 2014 Jun 3, at 12:42, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> It always amused me that we have
> 
> @a = weak global ...
> but
> @b = alias weak ...
> 
> I decided to dig why that is. The best I could find was
> 
> http://llvm.org/bugs/show_bug.cgi?id=1017#c15
> 
> Looking at some really old cold then suggests that the reason was that
> the old bison based parser hard a reduction for alias linkages and
> another one for global variable linkages. Putting the alias first
> avoided the reduce/reduce conflict.
> 
> The days of the old .ll parser are long gone, but is it too late to
> change? In case it is not, the attached patches implement just that
> :-)
> 
> Cheers,
> Rafael
> <clang.patch><llvm.patch>

This change SGTM -- the alias ordering is unnatural, and given the
current grammar, I don't think it makes parsing any easier.  Might
be worth pinging llvmdev about it though.

Also, it looks to me like you added an extra space in
test/CodeGenCXX/extern-c.cpp:

> diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp
> index fefb216..3e87d51 100644
> --- a/test/CodeGenCXX/extern-c.cpp
> +++ b/test/CodeGenCXX/extern-c.cpp
> @@ -59,10 +59,10 @@ extern "C" {
>  
>    // CHECK-NOT: @unused
>    // CHECK-NOT: @duplicate_internal
> -  // CHECK: @internal_var = alias internal i32* @_Z12internal_var
> +  // CHECK: @internal_var =  internal alias i32* @_Z12internal_var

here ~~~~~~~~~~~~~~~~~~~~~~~~~~^

>    // CHECK-NOT: @unused
>    // CHECK-NOT: @duplicate_internal
> -  // CHECK: @internal_fn = alias internal i32 ()* @_Z11internal_fnv
> +  // CHECK: @internal_fn = internal alias i32 ()* @_Z11internal_fnv
>    // CHECK-NOT: @unused
>    // CHECK-NOT: @duplicate_internal
>  }
> 





More information about the llvm-commits mailing list