[all-commits] [llvm/llvm-project] 35393c: [funcattrs] Infer nosync from instruction walk

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Apr 8 14:05:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 35393c865c2cb1afbf1315a9d48ac41994cd1344
      https://github.com/llvm/llvm-project/commit/35393c865c2cb1afbf1315a9d48ac41994cd1344
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
    M llvm/test/CodeGen/AMDGPU/inline-attr.ll
    M llvm/test/Transforms/FunctionAttrs/nofree.ll
    M llvm/test/Transforms/FunctionAttrs/nosync.ll
    M llvm/test/Transforms/FunctionAttrs/operand-bundles-scc.ll
    M llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
    M llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll

  Log Message:
  -----------
  [funcattrs] Infer nosync from instruction walk

Pretty straightforward use of existing infrastructure and port of the attributor inference rules for nosync.

A couple points of interest:
* I deliberately switched from "monotonic or better" to "unordered or better". This is simply me being conservative and is better in line with the rest of the optimizer. We treat monotonic conservatively pretty much everywhere.
* The operand bundle test change is suspicious. It looks like we might have missed something here, but if so, it's an issue with the existing nofree inference as well. I'm going to take a closer look at that separately.
* I needed to keep the previous inference from readnone. This surprised me, but made sense once I realized readonly inference goes to lengths to reason about local vs non-local memory and that writes to local memory are okay. This is fine for the purpose of nosync, but would e.g. prevent us from inferring nofree from readnone - which is slightly surprising.

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




More information about the All-commits mailing list