Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instcombine should recover more type info #1717

Closed
lattner opened this issue Apr 23, 2007 · 3 comments
Closed

instcombine should recover more type info #1717

lattner opened this issue Apr 23, 2007 · 3 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla code-quality

Comments

@lattner
Copy link
Collaborator

lattner commented Apr 23, 2007

Bugzilla Link 1345
Resolution FIXED
Resolved on Feb 22, 2010 12:48
Version 1.0
OS All
CC @sunfishcode

Extended Description

Instcombine should eliminate the two bitcasts in this example:

define i8* @​test(i8* %v) {
%A = alloca [4 x i8*], align 16 ; <[4 x i8*]> [#uses=3]
%B = getelementptr [4 x i8
]* %A, i32 0, i32 0 ; <i8**> [#uses=1]
store i8* null, i8** %B
%C = bitcast [4 x i8*]* %A to { [16 x i8] }* ; <{ [16 x i8] }> [#uses=1]
%D = getelementptr { [16 x i8] }
%C, i32 0, i32 0, i32 8 ; <i8*> [#uses=1]
%E = bitcast i8* %D to i8** ; <i8**> [#uses=1]
store i8* %v, i8** %E
%F = getelementptr [4 x i8*]* %A, i32 0, i32 2 ; <i8**> [#uses=1]
%G = load i8** %F ; <i8*> [#uses=1]
ret i8* %G
}

Doing so would allow SROA to eliminate the alloca, turning the function into an identity function.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Apr 23, 2007

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Apr 27, 2007

working on this.

@lattner
Copy link
Collaborator Author

lattner commented Apr 28, 2007

Implemented, patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048573.html

Testcase here: Transforms/InstCombine/bitcast-gep.ll

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla code-quality
Projects
None yet
Development

No branches or pull requests

1 participant