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
LLVM is considering that the if is always true.
test: extern int test_weak () attribute ((weak));
int main(){ int (*t)() = test_weak; if (t) return t(); else return 250; }
llc emits: .text .align 16 .globl main .type main,@function main: subl $4, %esp fnstcw 2(%esp) movb $2, 3(%esp) fldcw 2(%esp) .LBB1_1: #cond_true call test_weak addl $4, %esp ret .size main, .-main .weak test_weak
gcc emits: .file "teste.c" .text .p2align 4,,15 .globl main .type main, @function main: leal 4(%esp), %ecx andl $-16, %esp pushl -4(%ecx) movl $test_weak, %eax movl $250, %edx pushl %ebp movl %esp, %ebp pushl %ecx subl $4, %esp testl %eax, %eax je .L4 call test_weak movl %eax, %edx .L4: addl $4, %esp movl %edx, %eax popl %ecx popl %ebp leal -4(%ecx), %esp ret .size main, .-main .weak test_weak .ident "GCC: (GNU) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)" .section .note.GNU-stack,"",@progbits
The text was updated successfully, but these errors were encountered:
assigned to @lattner
Sorry, something went wrong.
This doesn't happen for me. I get:
$ llvm-gcc t.c -o - -S -O3 ... cmpl $0, L_test_weak$non_lazy_ptr-"L1$pb"(%eax) je LBB1_2 #UnifiedReturnBlock LBB1_1: #cond_true
What options are you compiling with?
-Chris
actually, I'm seeing it now, with llc.
Fixed, testcase here: test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll
Patch here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048483.html
refs llvm#1730 配置を諦めた場合にDebugLogを出力する
c0092b7
lattner
No branches or pull requests
Extended Description
LLVM is considering that the if is always true.
test:
extern int test_weak () attribute ((weak));
int main(){
int (*t)() = test_weak;
if (t)
return t();
else return 250;
}
llc emits:
.text
.align 16
.globl main
.type main,@function
main:
subl $4, %esp
fnstcw 2(%esp)
movb $2, 3(%esp)
fldcw 2(%esp)
.LBB1_1: #cond_true
call test_weak
addl $4, %esp
ret
.size main, .-main
.weak test_weak
gcc emits:
.file "teste.c"
.text
.p2align 4,,15
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
movl $test_weak, %eax
movl $250, %edx
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $4, %esp
testl %eax, %eax
je .L4
call test_weak
movl %eax, %edx
.L4:
addl $4, %esp
movl %edx, %eax
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.weak test_weak
.ident "GCC: (GNU) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)"
.section .note.GNU-stack,"",@progbits
The text was updated successfully, but these errors were encountered: