Commit 70e8887
committed
[BugFix][LLVM] Fix
ROCm ships its own LLVM 20 build that still uses the pre-LLVM-20
`Instruction*` overload of `DIBuilder::insertDeclare`, while upstream
LLVM 20 switched to `BasicBlock::iterator`. The previous version-number
guard `#if TVM_LLVM_VERSION >= 200` broke ROCm users on LLVM 20.
Replace the version guard with a CMake `check_cxx_source_compiles`
feature probe (`TVM_LLVM_INSERTDECLARE_USES_ITERATOR`) that compiles a
small test program to detect which overload is actually available.
Use `cmake_push_check_state`/`cmake_pop_check_state` to avoid leaking
CMake check variables. Three call sites in `codegen_llvm.cc` are
updated to use the new macro.
Fixes #18709insertDeclare API mismatch for ROCm-bundled LLVM 201 parent b14b023 commit 70e8887
2 files changed
Lines changed: 33 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
240 | 267 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2147 | 2147 | | |
2148 | 2148 | | |
2149 | 2149 | | |
2150 | | - | |
| 2150 | + | |
2151 | 2151 | | |
2152 | 2152 | | |
2153 | 2153 | | |
| |||
2193 | 2193 | | |
2194 | 2194 | | |
2195 | 2195 | | |
2196 | | - | |
2197 | | - | |
2198 | | - | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
2199 | 2200 | | |
2200 | 2201 | | |
2201 | 2202 | | |
| |||
2213 | 2214 | | |
2214 | 2215 | | |
2215 | 2216 | | |
2216 | | - | |
| 2217 | + | |
2217 | 2218 | | |
2218 | 2219 | | |
2219 | 2220 | | |
| |||
0 commit comments