[PATCH] D104473: RISCV: clean up target expression handling
Saleem Abdulrasool via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 10:26:58 PDT 2021
compnerd added inline comments.
================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp:95
const MCFixup *Fixup) const {
- bool IsSymbolicDifference = false;
- if (const auto *MBE = dyn_cast<MCBinaryExpr>(getSubExpr())) {
- if (isa<MCBinaryExpr>(MBE->getLHS()) && isa<MCConstantExpr>(MBE->getRHS()))
- MBE = cast<MCBinaryExpr>(MBE->getLHS());
- IsSymbolicDifference = isa<MCSymbolRefExpr>(MBE->getLHS()) &&
- isa<MCSymbolRefExpr>(MBE->getRHS());
- }
+ if (!getSubExpr()->evaluateAsRelocatable(Res, nullptr, nullptr))
+ return false;
----------------
MaskRay wrote:
> IIRC passing `Layout` can fold more expressions. In this case is `Layout` harmful?
Yes; I guess I should add a comment here as well. I put it in the commit message - this is intentional to prevent any type of expression folding involving symbols. We want the symbolic differences to be preserved.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104473/new/
https://reviews.llvm.org/D104473
More information about the llvm-commits
mailing list