[PATCH] D58034: [IR/DIVar] Add flag for params that have unchanged values
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 09:54:45 PST 2019
aprantl added a comment.
Thanks! I'm assuming the idea is that this is analyzed by the language frontend?
To make sure that we're getting the design right: Could you make an argument for why it is not sufficient to deduce this information at the MIR level by looking at the DBG_VALUEs of each variable?
For example, if the first DBG_VALUE is at the beginning of the variable's lexical scope and no other DBG_VALUE for the variable exists the variable should be constant, because every other SSA value associated with the same variable should have contributed another DBG_VALUE and even if the debug info got lost there should be a DBG_VALUE undef that survived. I guess it won't be hard to come up with a counterexample...
About the semantics: Does `!isNotChanged()` imply that the variable may be modified and should a MIR function with a *single* DBG_VALUE for a variable the `!isNotChanged()` throw a verifier error because we must have dropped another DBG_VALUE? Similarly, should or could the IR Verifier check for this?
Lastly, I've been meaning to add an `isConstant` flag to DIFlags to support programming languages with immutable variables (such as Swift `let` bindings) better. An isConstant would be emitted as a DW_TAG_constant instead of DW_TAG_variable. I'm wondering if `isNotChanged` and `isConstant` are close enough that they could be merged. What do you think?
CHANGES SINCE LAST ACTION
More information about the llvm-commits