llvm-project/llvm/lib/Transforms/ObjCARC
Akira Hatanaka c6f1713c46 [ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
a tail call

This reapplies the patch in https://reviews.llvm.org/rG1f5b471b8bf4,
which was reverted because it was causing crashes.

https://bugs.chromium.org/p/chromium/issues/detail?id=1061289#c2

Check that HasSafePathToCall is true before checking the call is a tail
call.

Original commit message:

Previosly ARC optimizer removed the autoreleaseRV/retainRV pair in the
following code, which caused the object returned by @something to be
placed in the autorelease pool because the call to @something isn't a
tail call:

```
  %call = call i8* @something(...)
  %2 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call)
  %3 = call i8* @objc_autoreleaseReturnValue(i8* %2)
  ret i8* %3
```

Fix the bug by checking whether @something is a tail call.

rdar://problem/59275894
2020-03-13 13:52:14 -07:00
..
ARCRuntimeEntryPoints.h [opaque pointer types] Pass function types to CallInst creation. 2019-02-01 20:43:25 +00:00
BlotMapVector.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" 2019-11-21 10:48:08 -08:00
DependencyAnalysis.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DependencyAnalysis.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjCARC.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjCARC.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjCARCAPElim.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ObjCARCContract.cpp Revert "[ObjC][ARC] Check the basic block size before calling DominatorTree::dominate" 2020-03-13 11:57:55 -07:00
ObjCARCExpand.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ObjCARCOpts.cpp [ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't 2020-03-13 13:52:14 -07:00
ProvenanceAnalysis.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProvenanceAnalysis.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProvenanceAnalysisEvaluator.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PtrState.cpp [ObjC][ARC] Skip debug instructions when computing the insert point of 2019-09-19 20:58:51 +00:00
PtrState.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00