[clang] [llvm] [polly] [NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (PR #123737)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 05:25:00 PST 2025
jmorse wrote:
> Regarding the direction of the patch, it seems a little unfortunate to completely remove getFirstNonPHI() - sometimes we want the instruction and sometimes we want the iterator, and forcing all of them to go through getFirstNonPHIIt() may increase the chances that the iterator and instruction are viewed as interchangeable and lead to people using &*BB->getFirstNonPHIIt() as an insertion point.
Indeed, this is the sharp end of RemoveDIs, we can't force all behaviours to be correct by using the type system, we have to accept some scope for misbehaviour. All things considered, I think having the type system bark at you beats relying on people to get it right each time. There's also some scope for static-analysis and dynamic instrumentation if we end up needing to scan for errors / risky behaviours.
(Pushing up rebased version then merging)
https://github.com/llvm/llvm-project/pull/123737
More information about the llvm-commits
mailing list