We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 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
The text was updated successfully, but these errors were encountered:
assigned to @lattner
Sorry, something went wrong.
working on this.
Implemented, patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048573.html
Testcase here: Transforms/InstCombine/bitcast-gep.ll
lattner
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: