[LLVMbugs] [Bug 5274] clang: doesn't add noalias attribute for restrict qualifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 6 03:23:01 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=5274

Pekka Jääskeläinen <pekka.jaaskelainen at tut.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |pekka.jaaskelainen at tut.fi
            Version|unspecified                 |2.7
         Resolution|FIXED                       |

--- Comment #2 from Pekka Jääskeläinen <pekka.jaaskelainen at tut.fi> 2010-05-06 05:23:01 CDT ---
This is broken (still/again?) in LLVM 2.7:

test2.c:

int foo(char *restrict s)
{
   return 0;
}

clang test2.c -c -emit-llvm -o - | llvm-dis

...

define i32 @foo(i8* %s) nounwind {
entry:
  %retval = alloca i32, align 4                   ; <i32*> [#uses=2]
  %s.addr = alloca i8*, align 8                   ; <i8**> [#uses=1]
  store i8* %s, i8** %s.addr
  store i32 0, i32* %retval
  %0 = load i32* %retval                          ; <i32> [#uses=1]
  ret i32 %0
}

vs.

tce-llvm-gcc --std=c99 test2.c -c --emit-llvm -o - | llvm-dis

...

define i32 @foo(i8* noalias %s) nounwind {
entry:
  %s_addr = alloca i8*                            ; <i8**> [#uses=1]
  %retval = alloca i32                            ; <i32*> [#uses=2]
  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
  store i8* %s, i8** %s_addr
  store i32 0, i32* %retval, align 4
  br label %return

return:                                           ; preds = %entry
  %retval1 = load i32* %retval                    ; <i32> [#uses=1]
  ret i32 %retval1
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list