[PATCH] D124728: Allow pointer types for atomicrmw xchg
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 14:21:36 PDT 2022
efriedma added inline comments.
================
Comment at: llvm/lib/AsmParser/LLParser.cpp:7459
+ if (!(Operation == AtomicRMWInst::Xchg && Val->getType()->isPointerTy())) {
+ unsigned Size = Val->getType()->getPrimitiveSizeInBits();
+ if (Size < 8 || (Size & (Size - 1)))
----------------
You can change this to get the size from the datalayout, instead of using getPrimitiveSizeInBits(). (Not that I really expect anyone to declare a non-power-of-two pointer type, but I don't think we actually forbid it.)
================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:290
+ (RMWI->getValOperand()->getType()->isFloatingPointTy() ||
+ RMWI->getValOperand()->getType()->isPointerTy())) {
// TODO: add a TLI hook to control this so that each target can
----------------
Can we try to preserve the pointer type where possible? cmpxchg can take a pointer.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124728/new/
https://reviews.llvm.org/D124728
More information about the llvm-commits
mailing list