This patch fixes tests masked.c and master.c on LoongArch.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Your change only allows offsets of 8 and 12 byte. But the comment indicates that 4 byte offset might still be possible? I think, you should just print the 12 byte offset in addition.
On LoongArch64, the following failures happened when i perform check-openmp:
4: 0: ompt_event_master_end: codeptr_ra=0x555556134c40 check:89'0 X error: no match found check:89'1 with "MASTER_ID" equal to "0" check:89'2 with "RETURN_ADDRESS_END" equal to "0x555556134c40" 5: 0: current_address=0x555556134c48 or 0x555556134c44
The macro print_current_address(id) prints the exact address that a previously called runtime function returns to.
As the above shown, the values of curren_address can not match the value of codeptr_ra (that is return address ) .
Disassemble it and generate the following codes:
0000000000000b98 <.omp_outlined.>: ... c3c: 57fc97ff bl -876(0xffffc94) # 8d0 <__kmpc_end_master@plt> c40: 50000400 b 4(0x4) # c44 <.omp_outlined.+0xac> c44: 03400000 andi $zero, $zero, 0x0 c48: 50000400 b 4(0x4) # c4c <.omp_outlined.+0xb4> c4c: 1a000104 pcalau12i $a0, 8(0x8) c50: 02c2c084 addi.d $a0, $a0, 176(0xb0)
And here the value of codeptr_ra is c40, the value of current_address is c48 or c44 caused by previously ((char *)addr) - 4 or ((char *)addr) - 8) wrong calculation.
But in D132925 which follows D59880 for RISCV64, why doesn't the current_address follow ((char *)addr) - 8 or ((char *)addr) - 12 in RISCV64? @prcups
I did not argue against adding ((char *)addr) - 12. But following the description in the comment, I think, ((char *)addr) - 4 should stay there, as this might still be valid for other cases (e.g., compiling with other optimization constraints?).
Yes, when compiling with optimization, ((char *)addr) - 4 is valid.
I have added it.
Thank you.