llvm-project/clang/test/CodeGenObjCXX
John McCall 7f416cc426 Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment.  Introduce APIs on CGBuilderTy to work with Address
values.  Change core APIs on CGF/CGM to traffic in Address where
appropriate.  Require alignments to be non-zero.  Update a ton
of code to compute and propagate alignment information.

As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.

The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned.  Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay.  I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.

Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.

We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment.  In particular,
field access now uses alignmentAtOffset instead of min.

Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs.  For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint.  That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.

ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments.  In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments.  That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.

I partially punted on applying this work to CGBuiltin.  Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.

llvm-svn: 246985
2015-09-08 08:05:57 +00:00
..
Inputs Objective-C. revert patch for rdar://17554063. 2014-10-28 18:28:16 +00:00
2007-10-03-MetadataPointers.mm
2010-08-04-Template.mm
2010-08-06-X.Y-syntax.mm
address-safety-attr.mm
arc-attrs.mm Don't pass -O0 to clang_cc1, it is the default. 2013-09-04 04:12:25 +00:00
arc-blocks.mm Test case updates for explicit type parameter to the gep operator 2015-03-13 18:21:46 +00:00
arc-cxx11-init-list.mm Have the driver and the target code agree on what the default ABI 2014-12-05 01:06:59 +00:00
arc-cxx11-member-init.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
arc-exceptions.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
arc-globals.mm Changed renaming of local symbols by inserting a dot vefore the numeric suffix 2015-05-12 16:48:43 +00:00
arc-mangle.mm Account for calling convention specifiers in function definitions in IR test cases 2015-06-29 17:29:50 +00:00
arc-move.mm Revert "Revert r234581, it might have caused a few miscompiles in Chromium." 2015-04-22 21:38:15 +00:00
arc-new-delete.mm Compute and preserve alignment more faithfully in IR-generation. 2015-09-08 08:05:57 +00:00
arc-pseudo-destructors.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
arc-references.mm Revert "Revert r234581, it might have caused a few miscompiles in Chromium." 2015-04-22 21:38:15 +00:00
arc-returns-inner-reference-ptr.mm
arc-special-member-functions.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
arc.mm Revert "Revert r234581, it might have caused a few miscompiles in Chromium." 2015-04-22 21:38:15 +00:00
block-id.mm CodeGenObjCXX: Add a test for r214699 2014-08-05 00:01:15 +00:00
block-in-template-inst.mm
block-var-layout.mm Don't pass -O0 to clang_cc1, it is the default. 2013-09-04 04:12:25 +00:00
blocks.mm
catch-id-type.mm Update clang to take into account the changes to personality fns 2015-06-17 20:53:19 +00:00
copy.mm
copyable-property-object.mm
debug-info-cyclic.mm Debug Info: Turn on ODR type uniquing for (the C++ part of) Objective-C++. 2015-06-15 23:18:16 +00:00
debug-info-line.mm Account for calling convention specifiers in function definitions in IR test cases 2015-06-29 17:29:50 +00:00
debug-info.mm
designated-initializers.mm [test] Follow-up for r243343, also add a test case using an enum for designated enum. 2015-07-28 00:01:13 +00:00
destroy.mm Emit DeferredDeclsToEmit in a DFS order. 2015-01-22 00:24:57 +00:00
encode.mm Use private linkage for globals we already name with \01L and \01l. 2014-02-27 19:01:11 +00:00
exceptions-legacy.mm Adjust clang side tests effected by 239795 before reapplying said change 2015-06-16 20:24:06 +00:00
exceptions.mm Update clang to take into account the changes to personality fns 2015-06-17 20:53:19 +00:00
externally-initialized-selectors.mm Don't manually insert L prefixes. 2014-11-06 13:30:38 +00:00
foreach-statement.mm
gc.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
implementation-in-extern-c.mm
implicit-copy-assign-operator.mm Mark C++ reference parameters as dereferenceable 2014-07-18 15:52:10 +00:00
implicit-copy-constructor.mm Mark C++ reference parameters as dereferenceable 2014-07-18 15:52:10 +00:00
ivar-objects.mm
lambda-expressions.mm [opaque pointer types] Explicit non-pointer type for call expressions 2015-04-16 23:25:00 +00:00
literals.mm Compute and preserve alignment more faithfully in IR-generation. 2015-09-08 08:05:57 +00:00
lvalue-reference-getter.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
mangle-blocks.mm Emit DeferredDeclsToEmit in a DFS order. 2015-01-22 00:24:57 +00:00
mangle.mm Implement the Objective-C __kindof type qualifier. 2015-07-07 03:58:42 +00:00
message-reference.mm Add a bunch of missing "CHECK" colons in tests. NFC. 2015-03-14 01:10:19 +00:00
message.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
method-local-extern-mangle.mm
microsoft-abi-arc-param-order.mm [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objects 2014-02-01 00:04:45 +00:00
nested-ehlocation.mm Merge ArtificialLocation into ApplyDebugLocation and make a clear 2015-02-03 18:40:42 +00:00
nrvo.mm CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail. 2013-08-15 06:47:53 +00:00
objc-container-subscripting-1.mm CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail. 2013-08-15 06:47:53 +00:00
objc-container-subscripting.mm CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail. 2013-08-15 06:47:53 +00:00
pr14474-gline-tables-only.mm
property-derived-to-base-conv.mm
property-dot-copy.mm
property-dot-reference.mm Mark C++ reference parameters as dereferenceable 2014-07-18 15:52:10 +00:00
property-lvalue-capture.mm Compute and preserve alignment more faithfully in IR-generation. 2015-09-08 08:05:57 +00:00
property-object-conditional-exp.mm Compute and preserve alignment more faithfully in IR-generation. 2015-09-08 08:05:57 +00:00
property-object-reference-1.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
property-object-reference-2.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
property-object-reference.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
property-objects.mm When building a pseudo-object assignment, and the RHS is 2015-08-22 00:35:27 +00:00
property-reference.mm Update Clang tests to handle explicitly typed load changes in LLVM. 2015-02-27 21:19:58 +00:00
refence-assign-write-barrier.mm
references.mm CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail. 2013-08-15 06:47:53 +00:00
rtti.mm type_info objects are not unnamed_addr: the ABI requires us to 2014-02-08 03:26:05 +00:00
selector-expr-lvalue.mm
subst-sel.mm AST: Consider pseudo-struct builtin types as substitutable 2014-11-28 22:22:46 +00:00
unknown-anytype.mm CHECK-LABEL-ify some code gen tests to improve diagnostic experience when tests fail. 2013-08-15 06:47:53 +00:00
write-barrier-global-assign.mm