[PATCH] D75815: [InstSimplify] Simplify calls with "returned" attribute

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 13:00:04 PST 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
nikic added a parent revision: D75814: [InstCombine] Don't simplify calls without uses.

If a call argument has the "returned" attribute, we can simplify the call to the value of that argument. The "-inst-simplify" pass already handled this for the constant integer argument case via known bits, which is invoked in `SimplifyInstruction`. However, non-constant (or non-int) arguments are not handled at all right now.

This addresses one of the regressions from D75801 <https://reviews.llvm.org/D75801>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75815

Files:
  lib/Analysis/InstructionSimplify.cpp
  test/Analysis/ValueTracking/known-nonnull-at.ll
  test/Transforms/InstCombine/align-attr.ll
  test/Transforms/InstCombine/expensive-combines.ll
  test/Transforms/InstCombine/fortify-folding.ll
  test/Transforms/InstCombine/strcpy_chk-1.ll
  test/Transforms/InstCombine/strncpy_chk-1.ll
  test/Transforms/InstCombine/unused-nonnull.ll
  test/Transforms/InstSimplify/call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75815.248957.patch
Type: text/x-patch
Size: 6895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200307/f3dfc929/attachment.bin>


More information about the llvm-commits mailing list