[all-commits] [llvm/llvm-project] 8ee575: Strip undef implying attributes when moving calls

annamthomas via All-commits all-commits at lists.llvm.org
Tue Jul 27 07:57:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ee5759fd50d147328f9e2a7ca9d6894721d0770
      https://github.com/llvm/llvm-project/commit/8ee5759fd50d147328f9e2a7ca9d6894721d0770
  Author: Anna Thomas <anna at azul.com>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/LICM/call-hoisting.ll
    M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
    M llvm/test/Transforms/SimplifyCFG/speculate-call.ll

  Log Message:
  -----------
  Strip undef implying attributes when moving calls

When hoisting/moving calls to locations, we strip unknown metadata. Such calls are usually marked `speculatable`, i.e. they are guaranteed to not cause undefined behaviour when run anywhere. So, we should strip attributes that can cause immediate undefined behaviour if those attributes are not valid in the context where the call is moved to.

This patch introduces such an API and uses it in relevant passes. See
updated tests.

Fix for PR50744.

Reviewed By: nikic, jdoerfert, lebedev.ri

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




More information about the All-commits mailing list