[all-commits] [llvm/llvm-project] ada137: [MC] Remove unneeded MCDataFragment check from Att...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Sun Jun 18 16:00:32 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ada137a4c2a292c34927f0f22bd4c6fba4d3df87
https://github.com/llvm/llvm-project/commit/ada137a4c2a292c34927f0f22bd4c6fba4d3df87
Author: Fangrui Song <i at maskray.me>
Date: 2023-06-18 (Sun, 18 Jun 2023)
Changed paths:
M llvm/lib/MC/MCExpr.cpp
Log Message:
-----------
[MC] Remove unneeded MCDataFragment check from AttemptToFoldSymbolOffsetDifference
If FA == FB, we can use SA.getOffset() - SB.getOffset() even if FA is
not a MCDataFragment, as the only case this can be problematic
(different offsets for a variable-size fragment) is invalid/unreachable.
If FA != FB, the `if (FI->getKind() != MCFragment::FT_Data)` check below
can bail out correctly.
This change will help Mach-O fold more expressions. For ELF this is NFC,
unless evaluateFixup has a bug that would evaluate an expression
differently.
More information about the All-commits
mailing list