[llvm] 0148b58 - [OMPIRBuilder] Remove the support for floating point values for atomic compare operation
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 18:15:19 PST 2022
Author: Shilei Tian
Date: 2022-02-09T21:15:15-05:00
New Revision: 0148b587149792fc62299d4f62a0f9a088c3f516
URL: https://github.com/llvm/llvm-project/commit/0148b587149792fc62299d4f62a0f9a088c3f516
DIFF: https://github.com/llvm/llvm-project/commit/0148b587149792fc62299d4f62a0f9a088c3f516.diff
LOG: [OMPIRBuilder] Remove the support for floating point values for atomic compare operation
This patch removes the type punning in atomic compare operation for
floating point values because the direct comparison doesn't make too much sense
for floating point values.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D119378
Added:
Modified:
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 6d9511abbdfb3..476686d65f9b4 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3481,26 +3481,16 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createAtomicCompare(
assert(X.Var->getType()->isPointerTy() &&
"OMP atomic expects a pointer to target memory");
- assert((X.ElemTy->isFloatingPointTy() || X.ElemTy->isIntegerTy() ||
- X.ElemTy->isPointerTy()) &&
- "OMP atomic compare expected a scalar type");
+ assert((X.ElemTy->isIntegerTy() || X.ElemTy->isPointerTy()) &&
+ "OMP atomic compare expected a integer scalar type");
if (Op == OMPAtomicCompareOp::EQ) {
- unsigned Addrspace = cast<PointerType>(X.Var->getType())->getAddressSpace();
- IntegerType *IntCastTy =
- IntegerType::get(M.getContext(), X.ElemTy->getScalarSizeInBits());
- Value *XAddr =
- X.ElemTy->isIntegerTy()
- ? X.Var
- : Builder.CreateBitCast(X.Var, IntCastTy->getPointerTo(Addrspace));
AtomicOrdering Failure = AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
// We don't need the result for now.
- (void)Builder.CreateAtomicCmpXchg(XAddr, E, D, MaybeAlign(), AO, Failure);
+ (void)Builder.CreateAtomicCmpXchg(X.Var, E, D, MaybeAlign(), AO, Failure);
} else {
assert((Op == OMPAtomicCompareOp::MAX || Op == OMPAtomicCompareOp::MIN) &&
"Op should be either max or min at this point");
- assert(X.ElemTy->isIntegerTy() &&
- "max and min operators only support integer type");
// Reverse the ordop as the OpenMP forms are
diff erent from LLVM forms.
// Let's take max as example.
More information about the llvm-commits
mailing list