[all-commits] [llvm/llvm-project] 33cbaa: [funcattrs] Consistently treat calling a function ...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Dec 17 09:02:33 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33cbaab1416b234d5a08b41e3110d64a00b0651c
      https://github.com/llvm/llvm-project/commit/33cbaab1416b234d5a08b41e3110d64a00b0651c
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-12-17 (Fri, 17 Dec 2021)

  Changed paths:
    M clang/test/CodeGen/arm-cmse-attr.c
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/test/Transforms/FunctionAttrs/nocapture.ll
    M llvm/test/Transforms/FunctionAttrs/writeonly.ll

  Log Message:
  -----------
  [funcattrs] Consistently treat calling a function pointer as a non-capturing read

We were being wildly inconsistent about what memory access was implied by an indirect function call. Depending on the call site attributes, you could get anything from a read, to unknown, to none at all. (The last was a miscompile.)

We were also always traversing the uses of a readonly indirect call. This is entirely unneeded as the indirect call does not capture. The callee might capture itself internally, but that has no implications for this caller. (See the nice explanation in the CaptureTracking comments if that case is confusing.)

Note that elsewhere in the same file, we were correctly computing the nocapture attribute for indirect calls. The changed case only resulted in conservatism when computing memory attributes if say the return value was written to.

Differential Revision: https://reviews.llvm.org/D115916




More information about the All-commits mailing list