Fangrui Song
bb03cdcb44
RISCV: Remove shouldForceRelocation and unneeded relocations
...
Follow-up to #140494
`shouldForceRelocation` is conservative and produces redundant
relocations.
For example, RISCVAsmBackend::ForceRelocs (introduced to support mixed
relax/norelax code) leads to redundant relocations in the following
example adapted from #77436
```
.option norelax
j label
// For assembly input, RISCVAsmParser::ParseInstruction sets ForceRelocs (https://reviews.llvm.org/D46423 ).
// For direct object emission, RISCVELFStreamer sets ForceRelocs (#77436 )
.option relax
call foo // linker-relaxable
.option norelax
j label // redundant relocation due to ForceRelocs
.option relax
label:
```
Root problem: The `isSymbolRefDifferenceFullyResolvedImpl` condition in
MCAssembler::evaluateFixup does not check whether two locations are
separated by a fragment whose size can be indeterminate due to linker
instruction (e.g. MCDataFragment with relaxation, or MCAlignFragment
due to indeterminate start offst).
This patch
* Updates the fragment walk code in
`attemptToFoldSymbolOffsetDifference` to treat MCRelaxableFragment
(for --riscv-asm-relax-branches) as fixed size after finishLayout.
* Adds a condition in `addReloc` to complement
`isSymbolRefDifferenceFullyResolvedImpl`.
* Removes the no longer needed `shouldForceRelocation`.
This fragment walk code path handles nicely handles
mixed relax/norelax case from
https://discourse.llvm.org/t/possible-problem-related-to-subtarget-usage/75283
and allows us to remove `MCSubtargetInfo` argument (#73721 ) as a follow-up.
This fragment walk code should be avoided in the absence of
linker-relaxable fragments within the current section.
Adjust two bolt/test/RISCV tests (#141310 )
Pull Request: https://github.com/llvm/llvm-project/pull/140692
2025-05-23 18:44:15 -07:00
..
2025-04-17 12:39:40 -07:00
2025-05-21 08:26:35 -07:00
2024-07-24 18:24:39 +01:00
2024-01-09 15:21:41 +08:00
2024-04-26 11:27:28 -07:00
2024-07-09 14:34:03 +08:00
2025-05-21 08:26:35 -07:00
2025-05-23 00:27:04 +08:00
2023-12-14 22:42:11 -08:00
2025-03-22 14:48:52 +08:00
2024-06-30 11:10:37 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-18 20:33:40 -07:00
2024-12-24 13:53:26 -08:00
2024-09-12 18:40:52 -07:00
2025-01-07 12:51:04 +00:00
2025-03-29 11:08:13 -07:00
2024-12-24 13:53:26 -08:00
2024-06-21 11:11:10 +08:00
2024-12-24 13:53:26 -08:00
2024-07-09 10:45:56 -07:00
2025-04-14 14:48:47 +08:00
2024-04-26 08:30:27 -07:00
2025-05-23 18:44:15 -07:00
2025-04-18 20:33:40 -07:00
2024-01-03 09:28:25 +08:00
2023-09-19 10:35:16 +08:00
2025-04-18 20:33:40 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-13 11:07:25 -07:00
2025-04-17 18:55:20 -07:00
2025-03-15 11:25:30 -07:00
2023-12-14 22:42:11 -08:00
2024-12-24 13:53:26 -08:00
2024-10-08 14:09:07 +01:00
2024-12-24 13:53:26 -08:00
2025-04-02 21:37:44 -07:00
2025-04-02 21:37:44 -07:00
2025-03-23 15:12:27 -07:00
2025-03-29 11:12:40 -07:00
2024-07-02 08:23:03 -07:00
2024-04-29 10:11:28 -07:00
2023-11-09 09:27:32 -08:00
2025-05-23 18:44:15 -07:00
2025-05-23 18:44:15 -07:00
2025-04-22 12:34:39 +08:00
2024-07-22 23:07:27 -07:00
2024-04-26 11:27:28 -07:00
2023-12-14 22:42:11 -08:00
2025-03-22 14:48:52 +08:00
2025-04-17 18:55:20 -07:00
2025-03-26 11:14:16 -07:00
2023-12-14 22:42:11 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-05-23 18:44:15 -07:00
2024-12-24 13:53:26 -08:00
2024-09-20 19:41:11 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-01 00:06:05 -07:00
2025-04-17 18:55:20 -07:00
2025-04-17 18:55:20 -07:00
2025-02-16 13:41:46 -08:00
2025-04-22 12:34:39 +08:00
2025-02-16 13:41:46 -08:00
2025-05-21 22:08:55 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-12 22:57:29 +02:00
2024-12-24 13:53:26 -08:00
2025-03-23 15:12:27 -07:00
2024-12-24 13:53:26 -08:00
2025-04-01 11:14:25 -07:00
2025-04-01 11:14:25 -07:00
2025-03-23 15:12:27 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-01 00:06:05 -07:00
2025-03-29 11:12:40 -07:00
2025-03-29 11:08:13 -07:00
2024-12-24 13:53:26 -08:00
2025-04-08 19:42:43 -07:00
2025-05-15 10:51:06 +08:00
2025-04-14 17:49:28 -07:00
2025-03-27 17:43:26 -07:00
2023-12-14 22:42:11 -08:00
2025-04-17 21:55:16 -07:00
2024-05-21 12:04:46 +08:00
2024-09-25 06:14:43 +01:00
2024-02-01 10:58:21 -08:00
2024-05-21 12:04:46 +08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-06-27 21:35:33 -07:00
2024-12-24 13:53:26 -08:00
2024-12-21 09:48:31 +00:00
2025-03-19 15:35:51 -07:00
2025-03-19 08:53:41 -07:00
2025-03-19 08:53:41 -07:00
2024-04-15 22:33:14 -07:00
2025-04-14 17:49:28 -07:00
2024-12-24 13:53:26 -08:00
2024-09-10 11:44:04 -07:00
2024-12-24 13:53:26 -08:00
2025-03-23 15:12:27 -07:00
2024-09-10 11:44:04 -07:00
2025-03-19 15:35:51 -07:00
2025-03-23 15:12:27 -07:00
2025-04-08 21:33:08 -07:00
2025-03-19 08:53:41 -07:00
2024-04-08 16:40:02 +08:00
2023-12-14 22:42:11 -08:00
2023-12-14 22:42:11 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-09-22 22:31:36 -07:00
2025-05-21 22:08:55 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-03-19 15:34:33 -07:00
2024-12-24 13:53:26 -08:00
2025-02-10 17:21:51 -08:00
2025-03-19 08:53:41 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-01 11:14:25 -07:00
2025-03-27 17:43:26 -07:00
2025-04-01 11:14:25 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-01 00:06:05 -07:00
2025-03-29 11:12:40 -07:00
2025-03-23 15:12:27 -07:00
2025-03-29 11:12:40 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-08 19:42:43 -07:00
2025-05-15 10:51:06 +08:00
2025-05-15 10:51:06 +08:00
2025-04-14 17:49:28 -07:00
2025-03-27 17:43:26 -07:00
2023-12-14 22:42:11 -08:00
2025-04-02 21:37:44 -07:00
2025-04-17 21:55:16 -07:00
2024-05-21 12:04:46 +08:00
2024-12-24 13:53:26 -08:00
2024-09-25 06:14:43 +01:00
2024-12-24 13:53:26 -08:00
2024-02-01 10:58:21 -08:00
2024-12-24 13:53:26 -08:00
2024-05-21 12:04:46 +08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-06-27 21:35:33 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-14 17:49:28 -07:00
2024-12-24 13:53:26 -08:00
2025-03-23 15:12:27 -07:00
2024-12-24 13:53:26 -08:00
2025-05-15 10:54:16 +08:00
2025-03-23 15:12:27 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2023-12-14 22:42:11 -08:00
2023-12-14 22:42:11 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-03-19 15:34:33 -07:00
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-03-29 11:12:40 -07:00
2024-12-24 13:53:26 -08:00
2025-03-31 20:49:51 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-03-29 11:12:40 -07:00
2024-09-12 19:33:59 -07:00
2023-12-14 22:42:11 -08:00
2025-03-23 15:12:27 -07:00
2025-03-30 22:03:14 -07:00
2025-03-29 11:12:40 -07:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-05-15 10:51:06 +08:00
2025-05-15 10:51:06 +08:00
2025-05-15 10:51:06 +08:00
2024-12-24 13:53:26 -08:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-06-03 17:27:02 +08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-04-15 22:33:14 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-03-18 17:55:36 -07:00
2025-03-23 15:12:27 -07:00
2025-03-29 11:12:40 -07:00
2025-03-18 14:41:06 -07:00
2025-03-18 17:55:36 -07:00
2025-03-29 11:12:40 -07:00
2025-03-18 17:55:36 -07:00
2025-03-23 15:12:27 -07:00
2025-03-29 11:12:40 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-24 13:53:26 -08:00
2024-04-08 16:40:02 +08:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-12-23 14:47:03 +00:00
2024-04-26 08:30:27 -07:00
2024-12-24 13:53:26 -08:00
2024-10-25 18:41:21 +11:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-04-13 11:07:25 -07:00
2025-04-17 18:55:20 -07:00
2025-04-15 08:52:00 -07:00
2025-03-23 15:12:27 -07:00
2024-12-24 13:53:26 -08:00
2025-04-28 17:23:51 +08:00
2025-04-28 17:23:51 +08:00
2025-04-28 17:23:51 +08:00
2025-04-28 17:23:51 +08:00
2025-05-15 10:14:58 +08:00
2025-05-12 16:58:39 +08:00
2025-04-15 23:17:03 +02:00
2025-04-15 23:17:03 +02:00
2025-02-26 08:09:20 -05:00
2025-02-26 08:09:20 -05:00
2025-03-23 15:12:27 -07:00
2025-04-08 19:42:43 -07:00
2025-03-18 15:18:43 +05:30
2025-05-23 18:44:15 -07:00
2025-04-18 20:33:40 -07:00
2025-04-08 19:42:43 -07:00
2025-04-02 12:14:50 +05:30
2025-05-23 14:20:31 +05:30
2025-02-10 17:21:51 -08:00
2025-04-08 19:42:43 -07:00
2025-02-10 17:21:51 -08:00
2025-05-23 14:20:31 +05:30
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2025-03-23 12:04:06 -07:00
2025-04-08 19:42:43 -07:00
2025-03-23 12:04:06 -07:00
2025-04-08 19:42:43 -07:00
2025-04-08 19:42:43 -07:00
2025-03-28 19:47:29 -07:00
2025-04-08 19:42:43 -07:00
2025-04-15 09:10:04 -07:00
2025-05-10 20:43:57 +05:30
2025-05-10 20:43:57 +05:30
2025-04-08 22:56:26 -07:00
2025-04-08 19:42:43 -07:00
2025-05-10 20:43:57 +05:30
2025-05-10 20:43:57 +05:30
2025-02-24 08:04:29 -08:00
2025-05-14 08:59:16 +05:30
2025-04-30 14:29:49 +05:30
2025-01-23 10:14:25 +05:30
2025-04-08 17:21:56 -07:00
2025-04-08 17:21:56 -07:00
2025-05-03 06:09:59 +05:30
2024-12-24 13:53:26 -08:00
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2025-03-18 09:05:22 -07:00
2025-04-08 19:42:43 -07:00
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2025-03-22 11:07:48 +05:30
2025-05-06 13:05:56 +05:30
2025-04-08 19:42:43 -07:00
2025-02-25 11:27:18 -08:00
2025-04-08 19:42:43 -07:00
2025-04-25 17:12:27 -07:00
2025-04-25 17:12:27 -07:00
2025-04-25 17:12:27 -07:00
2025-04-25 17:12:27 -07:00
2024-03-13 14:56:25 -07:00
2024-12-24 13:53:26 -08:00
2023-12-14 22:42:11 -08:00
2024-07-16 15:33:27 -07:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-02-10 09:07:51 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-05-15 10:54:16 +08:00
2025-05-15 10:54:16 +08:00
2025-05-15 10:54:16 +08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00
2025-02-10 17:21:51 -08:00
2024-12-24 13:53:26 -08:00
2024-12-24 13:53:26 -08:00