[all-commits] [llvm/llvm-project] 324091: [DAE] Adjust param/arg attributes when changing pa...

weiguozhi via All-commits all-commits at lists.llvm.org
Thu Mar 25 14:54:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3240910f000625957a6a01ff8758c892f72a3a0d
      https://github.com/llvm/llvm-project/commit/3240910f000625957a6a01ff8758c892f72a3a0d
  Author: Guozhi Wei <carrot at google.com>
  Date:   2021-03-25 (Thu, 25 Mar 2021)

  Changed paths:
    M llvm/include/llvm/IR/Attributes.h
    M llvm/include/llvm/IR/Function.h
    M llvm/include/llvm/IR/InstrTypes.h
    M llvm/lib/IR/Attributes.cpp
    M llvm/lib/IR/Function.cpp
    M llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
    A llvm/test/Transforms/DeadArgElim/NoundefAttrs.ll
    M llvm/test/Transforms/InstCombine/unused-nonnull.ll

  Log Message:
  -----------
  [DAE] Adjust param/arg attributes when changing parameter to undef

In DeadArgumentElimination pass, if a function's argument is never used, corresponding caller's parameter can be changed to undef. If the param/arg has attribute noundef or other related attributes, LLVM LangRef(https://llvm.org/docs/LangRef.html#parameter-attributes) says its behavior is undefined. SimplifyCFG(D97244) takes advantage of this behavior and does bad transformation on valid code.

To avoid this undefined behavior when change caller's parameter to undef, this patch removes noundef attribute and other attributes imply noundef on param/arg.

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




More information about the All-commits mailing list