[llvm] [SCCP] get rid of potentially dangling iterator (PR #105609)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 12:27:55 PDT 2024


fmayer wrote:

> > > Hi. I am not seeing a modification of KnownConstants between the point where the iterator is initialized and the point it is consumed. Am I missing something?
> > 
> > 
> > https://github.com/llvm/llvm-project/pull/105609/files#diff-066363256b7b4164e66b28a3028b2cb9e405c9136241baa33db76ebd2edb87cdL207
> 
> This insertion you have highlighted happens after the call to `visit` where the iterator is read.

Ah, you are right ... but I still don't really see a reason to store it as a iterator, rather than just the two pointers.

Also, should we unset it after the visit call, just to make that clear?

https://github.com/llvm/llvm-project/pull/105609


More information about the llvm-commits mailing list