[all-commits] [llvm/llvm-project] 037276: [InstCombine] Simplify calls with "returned" attri...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Mar 20 02:23:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 03727687766a72504712861bf038f0be962527d0
      https://github.com/llvm/llvm-project/commit/03727687766a72504712861bf038f0be962527d0
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-03-20 (Fri, 20 Mar 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/align-attr.ll
    M llvm/test/Transforms/InstCombine/call-returned.ll
    M llvm/test/Transforms/InstCombine/expensive-combines.ll
    M llvm/test/Transforms/InstCombine/fortify-folding.ll
    M llvm/test/Transforms/InstCombine/strcpy_chk-1.ll
    M llvm/test/Transforms/InstCombine/strncpy_chk-1.ll
    M llvm/test/Transforms/InstCombine/unused-nonnull.ll
    M llvm/test/Transforms/InstSimplify/call.ll

  Log Message:
  -----------
  [InstCombine] Simplify calls with "returned" attribute

If a call argument has the "returned" attribute, we can simplify
the call to the value of that argument. This was already partially
handled by InstSimplify/InstCombine for the case where the argument
is an integer constant, and the result is thus known via known bits.
The non-constant (or non-int) argument cases weren't handled though.

This previously landed as an InstSimplify transform, but was reverted
due to assertion failures when compiling the Linux kernel. The reason
is that simplifying a call to another call breaks assumptions in
call graph updating during inlining. As the code is not easy to fix,
and there is no particularly strong motivation for having this in
InstSimplify, the transform is only performed in InstCombine instead.

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




More information about the All-commits mailing list