[PATCH] D150144: cmake: add missing dependency on Attributes.inc

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 14:52:12 PDT 2023


jroelofs added a subscriber: etcwilde.
jroelofs added a comment.

Re-applying (shortly), because the revert broke the modules build again, which seems to have more short term positive impact than fixing the circular dependency:

  While building module 'LLVM_MC' imported from <redacted>/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h:29:
  While building module 'LLVM_IR' imported from <redacted>/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:60:
  In file included from <module-includes>:1:
  In file included from <redacted>/llvm-project/llvm/include/llvm/IR/AbstractCallSite.h:18:
  In file included from <redacted>/llvm-project/llvm/include/llvm/IR/Function.h:25:
  In file included from <redacted>/llvm-project/llvm/include/llvm/IR/Argument.h:17:
  <redacted>/llvm-project/llvm/include/llvm/IR/Attributes.h:88:14: fatal error: 'llvm/IR/Attributes.inc' file not found
     88 |     #include "llvm/IR/Attributes.inc"
        |              ^~~~~~~~~~~~~~~~~~~~~~~~
  While building module 'LLVM_MC' imported from <redacted>/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h:29:
  In file included from <module-includes>:17:
  In file included from <redacted>/llvm-project/llvm/include/llvm/MC/MCContext.h:22:
  <redacted>/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:60:10: fatal error: could not build module 'LLVM_IR'
     60 | #include "llvm/IR/PseudoProbe.h"
        |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
  In file included from <redacted>/llvm-project/llvm/utils/TableGen/CodeGenTarget.cpp:18:
  <redacted>/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h:29:10: fatal error: could not build module 'LLVM_MC'
     29 | #include "llvm/MC/LaneBitmask.h"
        |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
  3 errors generated.

I was able to reproduce @etcwilde's report of the circular dependency (as described in https://reviews.llvm.org/rGd462f65b8242a82d2430605a741825bf10ebaca0) by setting an absolute path: `LLVM_TABLEGEN=$BUILD/bin/llvm-tblgen` in the CMake config. That pointed me at this, which reveals the circular dependency as it removes the substitution of `llvm-min-tblgen` for `llvm-tblgen` for the generated include headers.

  commit 95d4506dda79d49e55fdd0e4da7bf81487167aa1
  Author: NAKAMURA Takumi <geek4civic at gmail.com>
  Date:   Tue May 2 17:02:06 2023 +0900
  
      add_tablegen: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen
      
      `sanitizer-x86_64-linux-android` uses LLVM_TABLEGEN.
  
  diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
  index be16127c724e..7fd6628ef55d 100644
  --- a/llvm/cmake/modules/TableGen.cmake
  +++ b/llvm/cmake/modules/TableGen.cmake
  @@ -154,6 +154,13 @@ macro(add_tablegen target project)
       endif()
     endif()
   
  +  # FIXME: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen
  +  if("${target}" STREQUAL "llvm-min-tblgen"
  +      AND NOT "${LLVM_TABLEGEN}" STREQUAL ""
  +      AND NOT "${LLVM_TABLEGEN}" STREQUAL "llvm-tblgen")
  +    set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}")
  +  endif()
  +
     if(ADD_TABLEGEN_EXPORT)
       set(${project}_TABLEGEN "${${project}_TABLEGEN_DEFAULT}" CACHE
         STRING "Native TableGen executable. Saves building one when cross-compiling.")

It seems both changes are necessary, but they don't work when we apply them both. @chapuni do you have any advice on how to fix this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150144/new/

https://reviews.llvm.org/D150144



More information about the llvm-commits mailing list