1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Verifier
Akira Hatanaka 078c441e76 [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of
explicitly emitting retainRV or claimRV calls in the IR

Background:

This fixes a longstanding problem where llvm breaks ARC's autorelease
optimization (see the link below) by separating calls from the marker
instructions or retainRV/claimRV calls. The backend changes are in
https://reviews.llvm.org/D92569.

https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue

What this patch does to fix the problem:

- The front-end adds operand bundle "clang.arc.attachedcall" to calls,
  which indicates the call is implicitly followed by a marker
  instruction and an implicit retainRV/claimRV call that consumes the
  call result. In addition, it emits a call to
  @llvm.objc.clang.arc.noop.use, which consumes the call result, to
  prevent the middle-end passes from changing the return type of the
  called function. This is currently done only when the target is arm64
  and the optimization level is higher than -O0.

- ARC optimizer temporarily emits retainRV/claimRV calls after the calls
  with the operand bundle in the IR and removes the inserted calls after
  processing the function.

- ARC contract pass emits retainRV/claimRV calls after the call with the
  operand bundle. It doesn't remove the operand bundle on the call since
  the backend needs it to emit the marker instruction. The retainRV and
  claimRV calls are emitted late in the pipeline to prevent optimization
  passes from transforming the IR in a way that makes it harder for the
  ARC middle-end passes to figure out the def-use relationship between
  the call and the retainRV/claimRV calls (which is the cause of
  PR31925).

- The function inliner removes an autoreleaseRV call in the callee if
  nothing in the callee prevents it from being paired up with the
  retainRV/claimRV call in the caller. It then inserts a release call if
  claimRV is attached to the call since autoreleaseRV+claimRV is
  equivalent to a release. If it cannot find an autoreleaseRV call, it
  tries to transfer the operand bundle to a function call in the callee.
  This is important since the ARC optimizer can remove the autoreleaseRV
  returning the callee result, which makes it impossible to pair it up
  with the retainRV/claimRV call in the caller. If that fails, it simply
  emits a retain call in the IR if retainRV is attached to the call and
  does nothing if claimRV is attached to it.

- SCCP refrains from replacing the return value of a call with a
  constant value if the call has the operand bundle. This ensures the
  call always has at least one user (the call to
  @llvm.objc.clang.arc.noop.use).

- This patch also fixes a bug in replaceUsesOfNonProtoConstant where
  multiple operand bundles of the same kind were being added to a call.

Future work:

- Use the operand bundle on x86-64.

- Fix the auto upgrader to convert call+retainRV/claimRV pairs into
  calls with the operand bundles.

rdar://71443534

Differential Revision: https://reviews.llvm.org/D92808
2021-02-12 09:51:57 -08:00
..
AMDGPU
ARM
Mips
SystemZ
2002-04-13-RetTypes.ll
2002-11-05-GetelementptrPointers.ll
2004-05-21-SwitchConstantMismatch.ll
2006-07-11-StoreStruct.ll
2006-10-15-AddrLabel.ll
2006-12-12-IntrinsicDefine.ll
2007-12-21-InvokeParamAttrs.ll
2008-01-11-VarargAttrs.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
2008-03-01-AllocaSized.ll
2008-11-15-RetVoid.ll
2009-05-29-InvokeResult1.ll
2009-05-29-InvokeResult2.ll
2009-05-29-InvokeResult3.ll
2010-08-07-PointerIntrinsic.ll
alias.ll
align-md.ll
align.ll Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
alloc-size-failedparse.ll
allocsize.ll
AmbiguousPhi.ll
amdgpu-cc.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
annotation-metadata.ll Add !annotation metadata and remarks pass. 2020-11-13 13:24:10 +00:00
array_allocated.ll
array_associated.ll
array_dataLocation.ll
array_rank.ll [DebugInfo] Support for DWARF attribute DW_AT_rank 2020-10-10 17:51:12 +05:30
assume-bundles.ll Reland [AssumeBundles] Use operand bundles to encode alignment assumptions 2020-09-12 15:36:06 +02:00
atomics.ll
bitcast-address-space-nested-global-cycle.ll
bitcast-address-space-nested-global.ll
bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll
bitcast-address-space-through-constant-inttoptr.ll
bitcast-address-space-through-gep-2.ll
bitcast-address-space-through-gep.ll
bitcast-address-space-through-inttoptr.ll
bitcast-address-spaces.ll
bitcast-alias-address-space.ll
bitcast-pointer-vector-neg.ll
bitcast-vector-pointer-as-neg.ll
bitcast-vector-pointer-as.ll
bitcast-vector-pointer-neg.ll
bitcast-vector-pointer-pos.ll
blockbyref.ll
bswap.ll
byref.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
byval-1.ll Verifier: Fix assert when verifying non-pointer byval or preallocated 2020-11-20 20:08:43 -05:00
byval-4.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
callbr.ll
callsite-dbgloc.ll
cc-flags.ll
comdat2.ll
comdat3.ll
comdat-decl1.ll
comdat-decl2.ll
comdat.ll
commandline-meta1.ll
commandline-meta2.ll
commandline-meta3.ll
commandline-meta4.ll
cttz-undef-arg.ll
dbg-difile-crash.ll
dbg-invalid-compileunit.ll
dbg-invalid-named-metadata.ll
dbg-invalid-retaintypes.ll
dbg-invalid-vector.ll
dbg-line-without-file.ll
dbg-null-retained-type.ll
dbg-orphaned-compileunit.ll
dbg-typerefs.ll
dbg.ll
deoptimize-intrinsic.ll
dereferenceable-md-inttoptr.ll
dereferenceable-md.ll
di-subroutine-localvar.ll
diderivedtype-address-space-atomic-type.ll
diderivedtype-address-space-const-type.ll
diderivedtype-address-space-friend.ll
diderivedtype-address-space-inheritance.ll
diderivedtype-address-space-member.ll
diderivedtype-address-space-ptr-to-member-type.ll
diderivedtype-address-space-restrict-type.ll
diderivedtype-address-space-rvalue-reference-type.ll
diderivedtype-address-space-typedef.ll
diderivedtype-address-space-volatile-type.ll
diexpression-dwarf-entry-value.ll
diexpression-entry-value-llvm-ir.ll
diexpression-entry-value.ll
diexpression-swap.ll
diexpression-valid-entry-value.ll Remove overzealous verifier check on DW_OP_LLVM_entry_value and improve the documentation 2021-02-04 10:58:35 -08:00
DIFile.ll
digenericsubrange-count-upperBound.ll [DebugInfo] Support for DW_TAG_generic_subrange 2020-10-29 01:34:15 +05:30
digenericsubrange-missing-stride.ll [DebugInfo] Support for DW_TAG_generic_subrange 2020-10-29 01:34:15 +05:30
digenericsubrange-missing-upperBound.ll [DebugInfo] Support for DW_TAG_generic_subrange 2020-10-29 01:34:15 +05:30
diglobalvariable.ll
dilocation-in-wrong-place.ll
DILocation-parents.ll
DILocation-scope.ll
disubprogram-name-match-only.ll
DISubprogram.ll
disubrange-count-upperBound.ll
disubrange-missing-upperBound.ll
dominates.ll
element-wise-atomic-memory-intrinsics.ll
extract-vector-mismatched-element-types.ll [SelectionDAG] Add llvm.vector.{extract,insert} intrinsics 2020-12-09 11:08:41 +00:00
fnarg-debuginfo.ll
fnarg-nodebug.ll
fp-intrinsics.ll [IR] Make nosync, nofree and willreturn default for intrinsics. 2020-10-20 11:57:19 +02:00
fpmath.ll
fragment.ll
frameescape.ll
func-dbg.ll
function-metadata-bad.ll
function-metadata-good.ll
gc_relocate_addrspace.ll
gc_relocate_operand.ll
gc_relocate_return.ll
gcread-ptrptr.ll
gcroot.ll
gcwrite-ptrptr.ll
get-active-lane-mask.ll [ARM] Fixup of a few test cases. NFC. 2020-09-09 11:14:44 +01:00
global-ctors-2.ll
global-ctors.ll
guard-intrinsic.ll
ident-meta1.ll
ident-meta2.ll
ident-meta3.ll
ident-meta4.ll
immarg-param-attribute-invalid.ll
inalloca1.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
inalloca2.ll
inalloca3.ll
inalloca-vararg.ll
insert-vector-mismatched-element-types.ll [SelectionDAG] Add llvm.vector.{extract,insert} intrinsics 2020-12-09 11:08:41 +00:00
intrinsic-arg-overloading-struct-ret.ll
intrinsic-bad-arg-type.ll
intrinsic-immarg.ll
invalid-disubrange-count-node.ll
invalid-disubrange-lowerBound.ll
invalid-disubrange-stride.ll
invalid-disubrange-upperBound.ll
invalid-eh.ll
invalid-frame-pointer-attr-empty.ll
invalid-frame-pointer-attr-no-value.ll
invalid-frame-pointer-attr.ll
invalid-patchable-function-entry.ll
invalid-statepoint.ll [Statepoint] Remove code related to inline operand bundles 2020-08-14 20:29:41 -07:00
invoke.ll
jumptable.ll
llvm.compiler_used-invalid-type.ll
llvm.dbg.declare-address.ll
llvm.dbg.declare-expression.ll
llvm.dbg.declare-variable.ll
llvm.dbg.intrinsic-dbg-attachment.ll
llvm.dbg.value-expression.ll
llvm.dbg.value-value.ll
llvm.dbg.value-variable.ll
llvm.loop-cu-strip.ll Have stripDebugInfo() also strip !llvm.loop annotations from all 2021-02-05 17:22:41 -08:00
llvm.loop.cu.ll
llvm.loop.ll
llvm.used-invalid-init2.ll
llvm.used-invalid-init.ll
llvm.used-invalid-type2.ll
llvm.used-invalid-type.ll
llvm.used-ptr-type.ll
masked-load.ll
masked-store.ll
matrix-intrinsics.ll
mdcompositetype-templateparams-tuple.ll
mdcompositetype-templateparams.ll
memcpy-inline.ll
memcpy.ll
metadata-function-dbg.ll
metadata-function-prof.ll
module-flags-1.ll
module-flags-2.ll
module-flags-3.ll
module-flags-cgprofile.ll
module-flags-semantic-interposition.ll
musttail-invalid.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
musttail-valid.ll
noalias_scope_decl.ll Introduce llvm.noalias.decl intrinsic 2021-01-16 09:20:45 +01:00
non-integer-gep-index.ll
non-integer-gep-index.ll.bc
non-integral-pointers.ll
noundef.ll Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
operand-bundles.ll [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 2021-02-12 09:51:57 -08:00
PhiGrouping.ll
pr34325.ll
preallocated-invalid.ll Verifier: Fix assert when verifying non-pointer byval or preallocated 2020-11-20 20:08:43 -05:00
preallocated-valid.ll
range-1.ll
range-2.ll
README.txt
recursive-struct-param.ll
recursive-type-1.ll
recursive-type-2.ll
recursive-type-3.ll
recursive-type-load.ll
recursive-type-store.ll
resume.ll
scalable-global-vars.ll [IR] Allow scalable vectors in structs to support intrinsics returning multiple values. 2021-01-17 23:29:51 -08:00
scalable-vector-struct-alloca.ll [IR] Allow scalable vectors in structs to support intrinsics returning multiple values. 2021-01-17 23:29:51 -08:00
scalable-vector-struct-load.ll [IR] Allow scalable vectors in structs to support intrinsics returning multiple values. 2021-01-17 23:29:51 -08:00
scalable-vector-struct-store.ll [IR] Allow scalable vectors in structs to support intrinsics returning multiple values. 2021-01-17 23:29:51 -08:00
scatter_gather.ll
SelfReferential.ll
speculatable-callsite-invalid.ll
speculatable-callsite.ll
sret.ll Verifier: Fix assert when verifying non-pointer byval or preallocated 2020-11-20 20:08:43 -05:00
statepoint.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
swifterror2.ll
swifterror3.ll
swifterror.ll
swiftself.ll
tbaa-allowed.ll
tbaa.ll
token1.ll
token2.ll
token3.ll
token4.ll
token5.ll
token6.ll
token7.ll
unique-disubprogram.ll Add a verifier check that rejects non-distinct DISubprogram function 2020-09-25 12:04:46 -07:00
unsized-types-alloca.ll
unsized-types-load.ll
unsized-types-store.ll
varargs-intrinsic.ll
variant-part.ll
vp-intrinsics.ll
weak-dllimport.ll Fix for PR46384. Failure on weak dllimport. 2020-09-02 19:12:24 -07:00
writeonly.ll
x86_intr.ll OpaquePtr: Require byval on x86_intrcc parameter 0 2020-12-14 16:34:37 -05:00

This directory contains testcases that the verifier is supposed to detect as
malformed LLVM code.  Testcases for situations that the verifier incorrectly
identifies as malformed should go in the test/Assembler directory.