r307723 - Enhance synchscope representation (clang)
Konstantin Zhuravlyov via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 11 15:23:37 PDT 2017
Author: kzhuravl
Date: Tue Jul 11 15:23:37 2017
New Revision: 307723
URL: http://llvm.org/viewvc/llvm-project?rev=307723&view=rev
Log:
Enhance synchscope representation (clang)
Relevant changes required for r307722.
Differential Revision: https://reviews.llvm.org/D33109
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/ms-barriers-intrinsics.c
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=307723&r1=307722&r2=307723&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jul 11 15:23:37 2017
@@ -1810,12 +1810,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(
case Builtin::BI__atomic_signal_fence:
case Builtin::BI__c11_atomic_thread_fence:
case Builtin::BI__c11_atomic_signal_fence: {
- llvm::SynchronizationScope Scope;
+ llvm::SyncScope::ID SSID;
if (BuiltinID == Builtin::BI__atomic_signal_fence ||
BuiltinID == Builtin::BI__c11_atomic_signal_fence)
- Scope = llvm::SingleThread;
+ SSID = llvm::SyncScope::SingleThread;
else
- Scope = llvm::CrossThread;
+ SSID = llvm::SyncScope::System;
Value *Order = EmitScalarExpr(E->getArg(0));
if (isa<llvm::ConstantInt>(Order)) {
int ord = cast<llvm::ConstantInt>(Order)->getZExtValue();
@@ -1825,17 +1825,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(
break;
case 1: // memory_order_consume
case 2: // memory_order_acquire
- Builder.CreateFence(llvm::AtomicOrdering::Acquire, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::Acquire, SSID);
break;
case 3: // memory_order_release
- Builder.CreateFence(llvm::AtomicOrdering::Release, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::Release, SSID);
break;
case 4: // memory_order_acq_rel
- Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, SSID);
break;
case 5: // memory_order_seq_cst
- Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
- Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, SSID);
break;
}
return RValue::get(nullptr);
@@ -1852,23 +1851,23 @@ RValue CodeGenFunction::EmitBuiltinExpr(
llvm::SwitchInst *SI = Builder.CreateSwitch(Order, ContBB);
Builder.SetInsertPoint(AcquireBB);
- Builder.CreateFence(llvm::AtomicOrdering::Acquire, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::Acquire, SSID);
Builder.CreateBr(ContBB);
SI->addCase(Builder.getInt32(1), AcquireBB);
SI->addCase(Builder.getInt32(2), AcquireBB);
Builder.SetInsertPoint(ReleaseBB);
- Builder.CreateFence(llvm::AtomicOrdering::Release, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::Release, SSID);
Builder.CreateBr(ContBB);
SI->addCase(Builder.getInt32(3), ReleaseBB);
Builder.SetInsertPoint(AcqRelBB);
- Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::AcquireRelease, SSID);
Builder.CreateBr(ContBB);
SI->addCase(Builder.getInt32(4), AcqRelBB);
Builder.SetInsertPoint(SeqCstBB);
- Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, Scope);
+ Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent, SSID);
Builder.CreateBr(ContBB);
SI->addCase(Builder.getInt32(5), SeqCstBB);
@@ -8039,13 +8038,13 @@ Value *CodeGenFunction::EmitX86BuiltinEx
case X86::BI__faststorefence: {
return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
- llvm::CrossThread);
+ llvm::SyncScope::System);
}
case X86::BI_ReadWriteBarrier:
case X86::BI_ReadBarrier:
case X86::BI_WriteBarrier: {
return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
- llvm::SingleThread);
+ llvm::SyncScope::SingleThread);
}
case X86::BI_BitScanForward:
case X86::BI_BitScanForward64:
Modified: cfe/trunk/test/CodeGen/ms-barriers-intrinsics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-barriers-intrinsics.c?rev=307723&r1=307722&r2=307723&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-barriers-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-barriers-intrinsics.c Tue Jul 11 15:23:37 2017
@@ -13,19 +13,19 @@ typedef __SIZE_TYPE__ size_t;
void test_ReadWriteBarrier() { _ReadWriteBarrier(); }
// CHECK-LABEL: define void @test_ReadWriteBarrier
-// CHECK: fence singlethread seq_cst
+// CHECK: fence syncscope("singlethread") seq_cst
// CHECK: ret void
// CHECK: }
void test_ReadBarrier() { _ReadBarrier(); }
// CHECK-LABEL: define void @test_ReadBarrier
-// CHECK: fence singlethread seq_cst
+// CHECK: fence syncscope("singlethread") seq_cst
// CHECK: ret void
// CHECK: }
void test_WriteBarrier() { _WriteBarrier(); }
// CHECK-LABEL: define void @test_WriteBarrier
-// CHECK: fence singlethread seq_cst
+// CHECK: fence syncscope("singlethread") seq_cst
// CHECK: ret void
// CHECK: }
More information about the cfe-commits
mailing list