LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 430 - Empty compaction tables defined
Summary: Empty compaction tables defined
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Bitcode Writer (show other bugs)
Version: 1.3
Hardware: All All
: P normal
Assignee: Reid Spencer
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2004-08-26 14:55 PDT by Robert Mykland
Modified: 2010-02-22 12:54 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
Bytecode For Robert's First Example (201 bytes, application/octet-stream)
2004-08-26 15:29 PDT, Reid Spencer
Details
Bytecode For Robert's Second Example (470 bytes, application/octet-stream)
2004-08-26 15:30 PDT, Reid Spencer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Mykland 2004-08-26 14:55:44 PDT
In all the simple code cases I've examined by hand so far, empty compaction
tables are defined for the functions that remain after full linking and inlining
(in both the cases below, a single function remains).

Case #1
-----
int main( void )
{
    return( 0 );
}
-----

Case #2
-----
#include <stdio.h>

int main( void )
{
    puts( "Hello world!" );
    return( 0 );
}
-----
Comment 1 Reid Spencer 2004-08-26 15:29:26 PDT
Created attachment 168 [details]
Bytecode For Robert's First Example

This bytecode file has an empty compaction table in it.
Comment 2 Reid Spencer 2004-08-26 15:30:22 PDT
Created attachment 169 [details]
Bytecode For Robert's Second Example

This also has an empty compaction table in it.
Comment 3 Reid Spencer 2004-08-26 15:32:50 PDT
Verified that this is a bug.  The empty compaction table is not being elided.
Comment 4 Reid Spencer 2004-08-26 16:11:36 PDT
This is a regression introduced in release 1.3 with the Type != Value change.
The problem is that the compaction table now consists of a Type list followed by
a set of planes of Values. Previously, it had just the planes of Values (because
Types were Values). Because the type list must write a 0 byte to indicate there
are no types, the block is not zero length and thus not automatically elided,
even if there are no planes of Values.

The fix for this isn't straight foward. You don't know that the planes of Values
won't all be omitted until you traverse them all (the compaction table can be
full of empty planes if that makes any sense).

I'll look into this when I have time. It only affects the size of the bytecode
file, not the quality of it.