Skip to content

-anders-aa and -gvn marks values as undefined incorrectly #2671

@edwintorok

Description

@edwintorok
Bugzilla Link 2299
Resolution LATER
Resolved on Nov 22, 2009 07:47
Version unspecified
OS Linux
Attachments testcase, C code, preprocessed source code
CC @asl

Extended Description

Using SVN r50866, opt -ander-aa -gvn marks some values as undefined, but that is not correct:

This portion of IR:
%buf2 = bitcast [8 x i32]* %buf12 to i8* ; <i8*> [#uses=1]
%tmp4 = call i64 @​fread( i8* noalias %buf2, i64 32, i64 1, %struct.FILE* noalias %tmp1 ) nounwind ; [#uses=0]
%tmp7 = load i32* %buf12.sub, align 4 ; [#uses=1]
%tmp9 = malloc i8, i32 %tmp7 ; <i8*> [#uses=1]

Gets turned into:

    %buf2 = bitcast [8 x i32]* %buf12 to i8*                ; <i8*> [#uses=1]
    %tmp4 = call i64 @&#8203;fread( i8* noalias  %buf2, i64 32, i64 1, %struct.FILE* noalias  %tmp1 ) nounwind             ; <i64> [#uses=0]
    %tmp9 = malloc i8, i32 undef            ; <i8*> [#uses=1]

To reproduce:
../../../Debug/bin/opt -anders-aa -gvn z.bc -o -|llvm-dis

-basic-aa works, does it get confused by the noalias mark?
FWIW the original C code had no aliases:
...
fread(buf,sizeof(buf),1,f);
use( malloc((int)buf) );
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions