Commit 56b096c
committed
[OMPIRBuilder][debug] Dont drop debug info for loop constructs.
In OMPIRBuilder, we have many cases where we dont handle the debug
location correctly while chaning the location or insertion point. This
is one of those cases.
Please see the following test program.
program main
implicit none
integer i, j
integer array(16384)
!$omp target teams distribute
DO i=1,16384
!$omp parallel do
DO j=1,16384
array(j) = i
ENDDO
!$omp end parallel do
ENDDO
!$omp end target teams distribute
print *, array
end program main
When tried to compile with the follownig command
flang -g -O2 -fopenmp test.f90 -o test --offload-arch=gfx90a
will fail in the verification with the following errors:
!dbg attachment points at wrong subprogram for function
This happens because we were dropping the debug locatoin in the
createCanonicalLoop so the call to the functions like
__kmpc_distribute_static_4u was without a debug locations. When it gets
inlined, the locations inside it are not adjusted as the call
instruction does not have the debug locations
(llvm/lib/Transforms/Utils/InlineFunction.cpp:fixupLineNumbers).
Later Verifier finds that this call have instruction with debug locations
that point to another function and fails. The fix is simple to not drop
the debug location.1 parent 329dfa1 commit 56b096c
File tree
2 files changed
+71
-1
lines changed- llvm/lib/Frontend/OpenMP
- mlir/test/Target/LLVMIR
2 files changed
+71
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4184 | 4184 | | |
4185 | 4185 | | |
4186 | 4186 | | |
4187 | | - | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
| 4191 | + | |
4188 | 4192 | | |
4189 | 4193 | | |
4190 | 4194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments