Commit Graph

9 Commits

Author SHA1 Message Date
Daniel Dunbar 5981377698 IRgen: Fix another case where we generated an invalid access component when we
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.

llvm-svn: 102068
2010-04-22 15:22:33 +00:00
Daniel Dunbar 5d6c07e0e9 IRgen: Fix case where we might generate an access component with width == 0, if
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).

llvm-svn: 102067
2010-04-22 14:56:10 +00:00
Daniel Dunbar fc66e0ed87 IRgen: Set alignment correctly on bit-field accesses.
llvm-svn: 102046
2010-04-22 03:17:04 +00:00
Daniel Dunbar 488f55c271 IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
- This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.

 - Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.

 - Review appreciated.

llvm-svn: 102045
2010-04-22 02:35:46 +00:00
Daniel Dunbar 20b551a443 IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.

llvm-svn: 101918
2010-04-20 17:52:30 +00:00
Anders Carlsson 8345a70c67 Fix an assert when assigning a boolean value to a bitfield of type _Bool.
llvm-svn: 101678
2010-04-17 21:52:22 +00:00
Daniel Dunbar 67aba79b74 IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

The new fixes from r101222 are:

 1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.

 2. Swap the order of arguments to OR, to get a tad more constant folding.

llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Daniel Dunbar 91ea6ac3e9 Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Daniel Dunbar 230e1541b3 IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

llvm-svn: 101222
2010-04-14 04:08:03 +00:00