This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Restrict qualifier doesn't work in TRUNK.


On Fri, Sep 11, 2009 at 4:11 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> Hello,
> I notice the restrict qualifier doesn't work properly in trunk any more.
> In the following example, the memory accesses of a, b, c don't have different
> alias set attached any more. Instead, the generic alias set of 2 is used
> for all accesses.
>
> I remember alias analysis part had some big changes since 4.5 branched out.
> Is it still in unstable phase, or is there some new hooks I should use for
> my port?

restrict is no longer encoded in the type-based alias-sets but in
the points-to sets that are reachable from the mems MEM_EXPR.
In case of TARGET_MEM_REFs you are (at the moment) out of luck
though.

Richard.

> Cheers,
> Bingfeng Mei
>
>
> void foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c)
> {
> ? int i;
> ? for(i = 0; i < 100; i+=4)
> ? ? {
> ? ? ? a[i] = b[i] * c[i];
> ? ? ? a[i+1] = b[i+1] * c[i+1];
> ? ? ? a[i+2] = b[i+2] * c[i+2];
> ? ? ? a[i+3] = b[i+3] * c[i+3];
> ? ? }
> }
>
> Before expand:
>
> foo (int * restrict a, int * restrict b, int * restrict c)
> {
> ?long unsigned int D.3213;
> ?long unsigned int ivtmp.32;
> ?long unsigned int ivtmp.31;
> ?long unsigned int ivtmp.29;
> ?int D.3168;
> ?int D.3167;
> ?int D.3165;
> ?int D.3160;
> ?int D.3159;
> ?int D.3157;
> ?int D.3152;
> ?int D.3151;
> ?int D.3149;
> ?int D.3143;
> ?int D.3142;
> ?int D.3140;
>
> ?# BLOCK 2 freq:385
> ?# PRED: ENTRY [100.0%] ?(fallthru,exec)
> ?ivtmp.29_77 = (long unsigned int) b_9(D);
> ?ivtmp.31_74 = (long unsigned int) c_14(D);
> ?ivtmp.32_83 = (long unsigned int) a_5(D);
> ?D.3213_85 = ivtmp.32_83 + 400;
> ?# SUCC: 3 [100.0%] ?(fallthru,exec)
>
> ?# BLOCK 3 freq:9615
> ?# PRED: 3 [96.0%] ?(true,exec) 2 [100.0%] ?(fallthru,exec)
> ?# ivtmp.29_79 = PHI <ivtmp.29_78(3), ivtmp.29_77(2)>
> ?# ivtmp.31_76 = PHI <ivtmp.31_75(3), ivtmp.31_74(2)>
> ?# ivtmp.32_73 = PHI <ivtmp.32_82(3), ivtmp.32_83(2)>
> ?D.3140_11 = MEM[index: ivtmp.29_79];
> ?D.3142_16 = MEM[index: ivtmp.31_76];
> ?D.3143_17 = D.3142_16 * D.3140_11;
> ?MEM[index: ivtmp.32_73] = D.3143_17;
> ?D.3149_26 = MEM[index: ivtmp.29_79, offset: 4];
> ?D.3151_31 = MEM[index: ivtmp.31_76, offset: 4];
> ?D.3152_32 = D.3151_31 * D.3149_26;
> ?MEM[index: ivtmp.32_73, offset: 4] = D.3152_32;
> ?D.3157_41 = MEM[index: ivtmp.29_79, offset: 8];
> ?D.3159_46 = MEM[index: ivtmp.31_76, offset: 8];
> ?D.3160_47 = D.3159_46 * D.3157_41;
> ?MEM[index: ivtmp.32_73, offset: 8] = D.3160_47;
> ?D.3165_56 = MEM[index: ivtmp.29_79, offset: 12];
> ?D.3167_61 = MEM[index: ivtmp.31_76, offset: 12];
> ?D.3168_62 = D.3167_61 * D.3165_56;
> ?MEM[index: ivtmp.32_73, offset: 12] = D.3168_62;
> ?ivtmp.29_78 = ivtmp.29_79 + 16;
> ?ivtmp.31_75 = ivtmp.31_76 + 16;
> ?ivtmp.32_82 = ivtmp.32_73 + 16;
> ?if (ivtmp.32_82 != D.3213_85)
> ? ?goto <bb 3>;
> ?else
> ? ?goto <bb 4>;
> ?# SUCC: 3 [96.0%] ?(true,exec) 4 [4.0%] ?(false,exec)
>
> ?# BLOCK 4 freq:385
> ?# PRED: 3 [4.0%] ?(false,exec)
> ?return;
> ?# SUCC: EXIT [100.0%]
>
> }
>
> Part of RTL
>
> ...
> insn 40 39 41 4 sms-6.c:11 (set (reg:SI 157)
> ? ? ? ?(mem:SI (reg:SI 151 [ ivtmp.31 ]) [2 S4 A32])) -1 (nil))
>
> (insn 41 40 42 4 sms-6.c:11 (set (reg:SI 158)
> ? ? ? ?(mem:SI (reg:SI 152 [ ivtmp.29 ]) [2 S4 A32])) -1 (nil))
>
> (insn 42 41 43 4 sms-6.c:11 (set (reg:SI 159)
> ? ? ? ?(mult:SI (reg:SI 157)
> ? ? ? ? ? ?(reg:SI 158))) -1 (nil))
>
> (insn 43 42 44 4 sms-6.c:11 (set (mem:SI (reg:SI 150 [ ivtmp.32 ]) [2 S4 A32])
> ? ? ? ?(reg:SI 159)) -1 (nil))
>
> (insn 44 43 45 4 sms-6.c:12 (set (reg:SI 160)
> ? ? ? ?(mem:SI (plus:SI (reg:SI 151 [ ivtmp.31 ])
> ? ? ? ? ? ? ? ?(const_int 4 [0x4])) [2 S4 A32])) -1 (nil))
>
> (insn 45 44 46 4 sms-6.c:12 (set (reg:SI 161)
> ? ? ? ?(mem:SI (plus:SI (reg:SI 152 [ ivtmp.29 ])
> ? ? ? ? ? ? ? ?(const_int 4 [0x4])) [2 S4 A32])) -1 (nil))
>
> (insn 46 45 47 4 sms-6.c:12 (set (reg:SI 162)
> ? ? ? ?(mult:SI (reg:SI 160)
> ? ? ? ? ? ?(reg:SI 161))) -1 (nil))
>
> (insn 47 46 48 4 sms-6.c:12 (set (mem:SI (plus:SI (reg:SI 150 [ ivtmp.32 ])
> ? ? ? ? ? ? ? ?(const_int 4 [0x4])) [2 S4 A32])
> ? ? ? ?(reg:SI 162)) -1 (nil))
>
> (insn 48 47 49 4 sms-6.c:13 (set (reg:SI 163)
> ? ? ? ?(mem:SI (plus:SI (reg:SI 151 [ ivtmp.31 ])
> ? ? ? ? ? ? ? ?(const_int 8 [0x8])) [2 S4 A32])) -1 (nil))
>
> (insn 49 48 50 4 sms-6.c:13 (set (reg:SI 164)
> ? ? ? ?(mem:SI (plus:SI (reg:SI 152 [ ivtmp.29 ])
> ? ? ? ? ? ? ? ?(const_int 8 [0x8])) [2 S4 A32])) -1 (nil))
> ...
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]