<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [Inline] Functions not inlined due to flag -Oz is not emitted"
href="http://llvm.org/bugs/show_bug.cgi?id=18163">18163</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[Inline] Functions not inlined due to flag -Oz is not emitted
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zhaoshiz@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11684" name="attach_11684" title="LLVM-IR generated with -Oz">attachment 11684</a> <a href="attachment.cgi?id=11684&action=edit" title="LLVM-IR generated with -Oz">[details]</a></span>
LLVM-IR generated with -Oz
This bug is causing "undefined reference" error at link time. It seems the
inliner is doing fine, please see attached test case.
$ cat test.h
extern int MAX_LEN;
extern int MIN_LEN;
extern int MAX_KEY;
struct HashTable;
extern struct HashTable* HT;
int HashAdd(struct HashTable* HT, int key, char* str);
int HashRemove(struct HashTable* HT, int key);
int hash(char* str, int len);
inline void goo (char* str, int len) {
if (len <= MAX_LEN && len >= MIN_LEN) {
int key = hash(str, len);
if (key <= MAX_LEN && key >= 0)
while (HashAdd(HT, key, str))
HashRemove(HT, key);
}
}
$ cat test.c
#include <string.h>
#include "test.h"
int MAX_LEN;
int MIN_LEN;
int MAX_KEY;
struct HashTable;
struct HashTable* HT;
int main (int argc, char* argv[]) {
unsigned i;
for (i=0; i<argc; ++i) {
int arglen = strlen(argv[i]);
goo (argv[i], arglen < MAX_LEN ? arglen : MAX_LEN);
}
}
$ cat Oz.s
.syntax unified
.cpu cortex-a9
.eabi_attribute 6, 10
.eabi_attribute 7, 65
.eabi_attribute 8, 1
.eabi_attribute 9, 2
.fpu neon
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 36, 1
.eabi_attribute 68, 1
.file "./test.c"
.text
.globl main
.align 2
.type main,%function
.code 16
.thumb_func
main:
push.w {r4, r5, r6, r7, r11, lr}
mov r5, r0
mov r4, r1
cbz r5, .LBB0_3
ldr r7, .LCPI0_0
.LBB0_2:
ldr r6, [r4], #4
mov r0, r6
bl strlen
ldr r1, [r7]
cmp r0, r1
it lt
movlt r1, r0
mov r0, r6
bl goo
subs r5, #1
bne .LBB0_2
.LBB0_3:
movs r0, #0
pop.w {r4, r5, r6, r7, r11, pc}
.align 2
.LCPI0_0:
.long MAX_LEN
.Ltmp0:
.size main, .Ltmp0-main
.type MAX_LEN,%object
.comm MAX_LEN,4,4
.type MIN_LEN,%object
.comm MIN_LEN,4,4
.type MAX_KEY,%object
.comm MAX_KEY,4,4
.type HT,%object
.comm HT,4,4</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>