[llvm] Don't collect from phi nodes which are not fully constructed yet (PR #140806)
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 09:48:39 PDT 2025
https://github.com/jdoerfert requested changes to this pull request.
This is not an appropriate fix for the underlying issue. The passes, incl. SCEV, are not expected to work on "broken" IR. You can try to "fix" one issue that pops up after the other, but at the end of the day, this can't work at scale. If Enzyme really needs SCEV during construction, which I hope can be avoided by running SCEV queries earlier, it needs to put the IR into a valid state. For the PHI case, that might mean adding `poison` inputs. However, keep in mind that SCEV, and other analyses, cache results and subsequent modifications need to properly invalidate the cache or other bad things are gonna happen.
Long story short, we need to look at the Enzyme use side and make it pre-query the SCEVs, or work w/o. Queries during (generic) code-generation/modification are effectively not supported.
https://github.com/llvm/llvm-project/pull/140806
More information about the llvm-commits
mailing list