[PATCH] D153096: [MC] Fold A-B when A's fragment precedes B's fragment
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 20:50:21 PDT 2023
MaskRay created this revision.
MaskRay added reviewers: efriedma, jrtc27, jyknight, nickdesaulniers.
Herald added a subscriber: hiraditya.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When the MCAssembler is non-null and the MCAsmLayout is null, we can fold A-B
when
- A and B are in the same fragment, or
- A's fragment suceeds B's fragment, and they are not separated by non-data fragments (D69411 <https://reviews.llvm.org/D69411>)
This patch allows folding when A's fragment precedes B's fragment so
that `9997b - . == 0` below can be evaluated as true:
nop
.arch_extension sec
9997:nop
// old behavior: error: expected absolute expression
.if 9997b - . == 0
.endif
Some Darwin tests check that this folding does not work. Adjust them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153096
Files:
llvm/lib/MC/MCExpr.cpp
llvm/test/MC/AArch64/arm64-small-data-fixups.s
llvm/test/MC/ARM/directive-if-subtraction.s
llvm/test/MC/MachO/absolutize.s
llvm/test/MC/MachO/darwin-x86_64-reloc.s
llvm/test/MC/MachO/reloc-diff.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153096.531977.patch
Type: text/x-patch
Size: 5733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230616/a26c8f54/attachment-0001.bin>
More information about the llvm-commits
mailing list