[llvm] [CMake] Move common target dependencies into ${TARGET_LIBRARIES} (PR #141271)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 13:24:27 PDT 2025
topperc wrote:
> > > adding a call from an STI reference to an Analysis function would result in a build error coming from one of them, even if you're not working on that particular backend.
> >
> >
> > just want to make sure: I guess you mean adding a call to Analysis into a STI function that is used by backends that are not currently linking Analysis, right?
>
> Hi Min,
>
> I added a call to isNoAlias() for something I'm working on which I wanted to be overridable by backends. So I put its implementation in TargetSubtargetInfo.h. However, this caused link errors for AVR, MSP430, Sparc and Xtensa. These are backends I definitely wasn't touching and it took me awhile to figure out exactly what was happening.
>
> All of the other backends already include Analysis in the library list of their CMakelist.txt files except for those 4. For example, RISCV includes Analysis despite not including AliasAnalysis.h in any of its source files. (I haven't checked but I don't think Analysis gets called transitively.)
>
> What I want to do is oversolve the problem so that the next developer doesn't have to solve the build problems I had to. FWIW, I think this qualifies as NFC.
I discussed this with @CBSears on Discord. The particular change added a call to isNoAlias to TargetSubtargetInfo.h. This was the first use of an analysis header file in that file. This caused any target that includes TargetSubtargetInfo.h to transitive include an Analysis header. The particular Analysis header has function definitions that reference functions in the Analysis library. If those functions implemented in the header aren't optimized out because you're using a Debug build, the files that include TargetSubtargetInfo.h now depend on the Analysis library through those functions.
https://github.com/llvm/llvm-project/pull/141271
More information about the llvm-commits
mailing list