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

llvm.va_* intrinsics vary in type #1465

Closed
lattner opened this issue Jan 7, 2007 · 5 comments
Closed

llvm.va_* intrinsics vary in type #1465

lattner opened this issue Jan 7, 2007 · 5 comments
Labels
bugzilla Issues migrated from bugzilla code-cleanup llvm:core

Comments

@lattner
Copy link
Collaborator

lattner commented Jan 7, 2007

Bugzilla Link 1093
Resolution FIXED
Resolved on Feb 22, 2010 12:42
Version 1.0
OS All

Extended Description

The CFE currently produces llvm.va_* intrinsics where the va_list type varies according to the target. The
LangRef document describes this behavior. Both should be updated to change the pointer to always be
'i8*' so that there is always a consistent type.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Jan 8, 2007

Example of before:

define void %testVaCopyArg(i8* %fmt, ...) {
entry:
%ap = alloca i8*, align 4 ; <i8**> [#uses=3]
%aq = alloca i8*, align 4 ; <i8**> [#uses=3]
%memtmp = alloca i8* ; <i8**> [#uses=2]
call void %llvm.va_start( i8** %ap )
%tmp = load i8** %ap ; <i8*> [#uses=1]
store i8* %tmp, i8** %memtmp
call void %llvm.va_copy( i8** %aq, i8** %memtmp )
%tmp1 = load i8** %aq ; <i8*> [#uses=1]
call void %test( i8* %fmt, i8* %tmp1 )
call void %llvm.va_end( i8** %aq )
call void %llvm.va_end( i8** %ap )
ret void
}

after:

define void %testVaCopyArg(i8* %fmt, ...) {
entry:
%ap = alloca i8*, align 4 ; <i8**> [#uses=2]
%aq = alloca i8*, align 4 ; <i8**> [#uses=2]
%memtmp = alloca i8* ; <i8**> [#uses=2]
%ap = bitcast i8** %ap to i8* ; <i8*> [#uses=2]
call void %llvm.va_start( i8* %ap )
%tmp = load i8** %ap ; <i8*> [#uses=1]
store i8* %tmp, i8** %memtmp
%aq = bitcast i8** %aq to i8* ; <i8*> [#uses=2]
%memtmp = bitcast i8** %memtmp to i8* ; <i8*> [#uses=1]
call void %llvm.va_copy( i8* %aq, i8* %memtmp )
%tmp1 = load i8** %aq ; <i8*> [#uses=1]
call void %test( i8* %fmt, i8* %tmp1 )
call void %llvm.va_end( i8* %aq )
call void %llvm.va_end( i8* %ap )
ret void
}

the difference is that the intrinsics all take i8* as the valist pointer.

Reid, please make llvm-upgrade handle this. Thanks!

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Jan 8, 2007

The CFE and LangRef have been updated, the only piece left is llvm-upgrade.

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 12, 2007

What exactly is the transform you want on llvm-upgrade? I'm seeing it as:

for any intrinsic starting with llvm.va_, bitcast any pointer argument to i8*
before the instruction.

Is that correct?

@lattner
Copy link
Collaborator Author

lattner commented Jan 12, 2007

yep, sounds right!

@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-cleanup llvm:core
Projects
None yet
Development

No branches or pull requests

2 participants