@@ -8939,7 +8939,6 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createAtomicCompare(
8939
8939
bool IsInteger = E->getType ()->isIntegerTy ();
8940
8940
8941
8941
if (Op == OMPAtomicCompareOp::EQ) {
8942
- #if 1
8943
8942
// TODO: Get TLI and TL from frontend
8944
8943
Triple T (Builder.GetInsertBlock ()->getModule ()->getTargetTriple ());
8945
8944
TargetLibraryInfoImpl TLII (T);
@@ -9017,88 +9016,6 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createAtomicCompare(
9017
9016
: Builder.CreateZExt (SuccessOrFail, R.ElemTy );
9018
9017
Builder.CreateStore (ResultCast, R.Var , R.IsVolatile );
9019
9018
}
9020
-
9021
- #else
9022
-
9023
- // TODO: Use emitAtomicCompareExchangeBuiltin(...)
9024
- AtomicCmpXchgInst *Result = nullptr;
9025
- if (!IsInteger) {
9026
- IntegerType *IntCastTy =
9027
- IntegerType::get(M.getContext(), X.ElemTy->getScalarSizeInBits());
9028
- Value *EBCast = Builder.CreateBitCast(E, IntCastTy);
9029
- Value *DBCast = Builder.CreateBitCast(D, IntCastTy);
9030
- Result = Builder.CreateAtomicCmpXchg(X.Var, EBCast, DBCast, MaybeAlign(),
9031
- AO, Failure);
9032
- } else {
9033
- Result =
9034
- Builder.CreateAtomicCmpXchg(X.Var, E, D, MaybeAlign(), AO, Failure);
9035
- }
9036
-
9037
- if (V.Var) {
9038
- Value *OldValue = Builder.CreateExtractValue(Result, /*Idxs=*/0);
9039
- if (!IsInteger)
9040
- OldValue = Builder.CreateBitCast(OldValue, X.ElemTy);
9041
- assert(OldValue->getType() == V.ElemTy &&
9042
- "OldValue and V must be of same type");
9043
- if (IsPostfixUpdate) {
9044
- Builder.CreateStore(OldValue, V.Var, V.IsVolatile);
9045
- } else {
9046
- Value *SuccessOrFail = Builder.CreateExtractValue(Result, /*Idxs=*/1);
9047
- if (IsFailOnly) {
9048
- // CurBB----
9049
- // | |
9050
- // v |
9051
- // ContBB |
9052
- // | |
9053
- // v |
9054
- // ExitBB <-
9055
- //
9056
- // where ContBB only contains the store of old value to 'v'.
9057
- BasicBlock *CurBB = Builder.GetInsertBlock();
9058
- Instruction *CurBBTI = CurBB->getTerminator();
9059
- CurBBTI = CurBBTI ? CurBBTI : Builder.CreateUnreachable();
9060
- BasicBlock *ExitBB = CurBB->splitBasicBlock(
9061
- CurBBTI, X.Var->getName() + ".atomic.exit");
9062
- BasicBlock *ContBB = CurBB->splitBasicBlock(
9063
- CurBB->getTerminator(), X.Var->getName() + ".atomic.cont");
9064
- ContBB->getTerminator()->eraseFromParent();
9065
- CurBB->getTerminator()->eraseFromParent();
9066
-
9067
- Builder.CreateCondBr(SuccessOrFail, ExitBB, ContBB);
9068
-
9069
- Builder.SetInsertPoint(ContBB);
9070
- Builder.CreateStore(OldValue, V.Var);
9071
- Builder.CreateBr(ExitBB);
9072
-
9073
- if (UnreachableInst *ExitTI =
9074
- dyn_cast<UnreachableInst>(ExitBB->getTerminator())) {
9075
- CurBBTI->eraseFromParent();
9076
- Builder.SetInsertPoint(ExitBB);
9077
- } else {
9078
- Builder.SetInsertPoint(ExitTI);
9079
- }
9080
- } else {
9081
- Value *CapturedValue =
9082
- Builder.CreateSelect(SuccessOrFail, E, OldValue);
9083
- Builder.CreateStore(CapturedValue, V.Var, V.IsVolatile);
9084
- }
9085
- }
9086
- }
9087
-
9088
- // The comparison result has to be stored.
9089
- if (R.Var) {
9090
- assert(R.Var->getType()->isPointerTy() &&
9091
- "r.var must be of pointer type");
9092
- assert(R.ElemTy->isIntegerTy() && "r must be of integral type");
9093
-
9094
- Value *SuccessFailureVal = Builder.CreateExtractValue(Result, /*Idxs=*/1);
9095
- Value *ResultCast = R.IsSigned
9096
- ? Builder.CreateSExt(SuccessFailureVal, R.ElemTy)
9097
- : Builder.CreateZExt(SuccessFailureVal, R.ElemTy);
9098
- Builder.CreateStore(ResultCast, R.Var, R.IsVolatile);
9099
- }
9100
- #endif
9101
-
9102
9019
} else {
9103
9020
assert ((Op == OMPAtomicCompareOp::MAX || Op == OMPAtomicCompareOp::MIN) &&
9104
9021
" Op should be either max or min at this point" );
0 commit comments