[all-commits] [llvm/llvm-project] 1f5b47: [ObjC][ARC] Don't remove autoreleaseRV/retainRV pa...

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Mon Mar 9 13:22:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f5b471b8bf4c6d22fb13d8e24bc31c75245b0d0
      https://github.com/llvm/llvm-project/commit/1f5b471b8bf4c6d22fb13d8e24bc31c75245b0d0
  Author: ahatanak <ahatanaka at apple.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
    M llvm/test/Transforms/ObjCARC/rv.ll

  Log Message:
  -----------
  [ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't
a tail call

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




More information about the All-commits mailing list