[MC] Fold A-B when A's fragment precedes B's fragment
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) 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 ``` Add a case to llvm/test/MC/ARM/directive-if-subtraction.s. Note: for MCAsmStreamer, we cannot evaluate `.if . - 9997b == 0` at parse time due to MCAsmStreamer::getAssemblerPtr returning nullptr (D45164). Some Darwin tests check that this folding does not work. Add `.p2align 2` to block some label difference folding or adjust the tests. Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D153096
Loading
Please sign in to comment