[Assignment Tracking] Only set module flag if pass modifies a function
authorOCHyams <orlando.hyams@sony.com>
Wed, 22 Feb 2023 16:29:44 +0000 (16:29 +0000)
committerOCHyams <orlando.hyams@sony.com>
Wed, 22 Feb 2023 16:57:07 +0000 (16:57 +0000)
commit3e48c8d75d1ca937ab3595909fb4198226c4ad1d
tree9f6e03e4d687a8e44d680f759ccc14578a13a175
parent80a8e6805ab8e318662240d63e1e3b6c08667b45
[Assignment Tracking] Only set module flag if pass modifies a function

The module flag "debug-info-assignment-tracking" is set by the
declare-to-assign pass to indicate that assignment tracking is enabled. This
patch changes declare-to-assign to only set the flag if it makes a
modification. This lets the compiler avoid doing extra work for no benefit,
such as is currently the case if assignment tracking is requested for a build
with line tables only (-gmlt) or a build without debug info.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D144481
llvm/include/llvm/IR/DebugInfo.h
llvm/lib/IR/DebugInfo.cpp
llvm/test/DebugInfo/Generic/assignment-tracking/declare-to-assign/set-flag-only-if-modified.ll [new file with mode: 0644]