This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Commit e151b1d
authored
[MLIR][OpenMP] Use correct DebugLoc in target construct callbacks. (llvm#125856)
This is same as PR llvm#125106 which somehow is stuck in a "Processing
Update" loop for many hours now. I am going to close that one and push
this one instead.
While working on llvm#125088, I
noticed a problem with the TargetBodyGenCallbackTy and
TargetGenArgAccessorsCallbackTy. The OMPIRBuilder and MLIR side Both
maintain their own IRBuilder and when control goes from one to other, we
have to take care to not use a stale debug location. The code currently
rely on restoreIP to set the insertion point and the debug location. But
if the passes InsertPointTy has an empty block, then the debug location
will not be updated (see SetInsertPoint). This can cause invalid debug
location to be attached to instruction and the verifier will complain.
Similarly when we exit the callback, the debug location of the Builder
is not set to what it was before the callback. This again can cause
verification failures.
This PR resets the debug location at the start and also uses an
InsertPointGuard to restore the debug location at exit.
Both of these problems would have been caught by the unit tests but they
were not setting the debug location of the builder before calling the
createTarget so the problem was hidden. I have updated the tests
accordingly.1 parent ccd92ec commit e151b1d
File tree
2 files changed
+22
-0
lines changed- llvm/unittests/Frontend
- mlir/lib/Target/LLVMIR/Dialect/OpenMP
2 files changed
+22
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6180 | 6180 | | |
6181 | 6181 | | |
6182 | 6182 | | |
| 6183 | + | |
6183 | 6184 | | |
6184 | 6185 | | |
6185 | 6186 | | |
| |||
6189 | 6190 | | |
6190 | 6191 | | |
6191 | 6192 | | |
| 6193 | + | |
| 6194 | + | |
6192 | 6195 | | |
6193 | 6196 | | |
6194 | 6197 | | |
| |||
6206 | 6209 | | |
6207 | 6210 | | |
6208 | 6211 | | |
| 6212 | + | |
| 6213 | + | |
6209 | 6214 | | |
6210 | 6215 | | |
6211 | 6216 | | |
| |||
6252 | 6257 | | |
6253 | 6258 | | |
6254 | 6259 | | |
| 6260 | + | |
6255 | 6261 | | |
6256 | 6262 | | |
6257 | 6263 | | |
| |||
6350 | 6356 | | |
6351 | 6357 | | |
6352 | 6358 | | |
| 6359 | + | |
6353 | 6360 | | |
6354 | 6361 | | |
6355 | 6362 | | |
| |||
6361 | 6368 | | |
6362 | 6369 | | |
6363 | 6370 | | |
| 6371 | + | |
| 6372 | + | |
6364 | 6373 | | |
6365 | 6374 | | |
6366 | 6375 | | |
| |||
6394 | 6403 | | |
6395 | 6404 | | |
6396 | 6405 | | |
| 6406 | + | |
| 6407 | + | |
6397 | 6408 | | |
6398 | 6409 | | |
6399 | 6410 | | |
| |||
6415 | 6426 | | |
6416 | 6427 | | |
6417 | 6428 | | |
| 6429 | + | |
6418 | 6430 | | |
6419 | 6431 | | |
6420 | 6432 | | |
| |||
6722 | 6734 | | |
6723 | 6735 | | |
6724 | 6736 | | |
| 6737 | + | |
6725 | 6738 | | |
6726 | 6739 | | |
6727 | 6740 | | |
| |||
6732 | 6745 | | |
6733 | 6746 | | |
6734 | 6747 | | |
| 6748 | + | |
| 6749 | + | |
6735 | 6750 | | |
6736 | 6751 | | |
6737 | 6752 | | |
| |||
6767 | 6782 | | |
6768 | 6783 | | |
6769 | 6784 | | |
| 6785 | + | |
| 6786 | + | |
6770 | 6787 | | |
6771 | 6788 | | |
6772 | 6789 | | |
| |||
6789 | 6806 | | |
6790 | 6807 | | |
6791 | 6808 | | |
| 6809 | + | |
6792 | 6810 | | |
6793 | 6811 | | |
6794 | 6812 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4229 | 4229 | | |
4230 | 4230 | | |
4231 | 4231 | | |
| 4232 | + | |
| 4233 | + | |
4232 | 4234 | | |
4233 | 4235 | | |
4234 | 4236 | | |
| |||
4324 | 4326 | | |
4325 | 4327 | | |
4326 | 4328 | | |
| 4329 | + | |
| 4330 | + | |
4327 | 4331 | | |
4328 | 4332 | | |
4329 | 4333 | | |
| |||
0 commit comments