Enhance synchscope representation
authorKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Tue, 11 Jul 2017 22:23:00 +0000 (22:23 +0000)
committerKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Tue, 11 Jul 2017 22:23:00 +0000 (22:23 +0000)
commitbb80d3e1d34a0fa4374f1d6f199bd49d4b21abf0
tree3bfb08cef177d7168d07c487eb88e7f40cac566f
parent1d06f44f0f0c7d17ff649782a5f897dd563d1031
Enhance synchscope representation

  OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
  global and local memory. These scopes restrict how synchronization is
  achieved, which can result in improved performance.

  This change extends existing notion of synchronization scopes in LLVM to
  support arbitrary scopes expressed as target-specific strings, in addition to
  the already defined scopes (single thread, system).

  The LLVM IR and MIR syntax for expressing synchronization scopes has changed
  to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
  replaces *singlethread* keyword), or a target-specific name. As before, if
  the scope is not specified, it defaults to CrossThread/System scope.

  Implementation details:
    - Mapping from synchronization scope name/string to synchronization scope id
      is stored in LLVM context;
    - CrossThread/System and SingleThread scopes are pre-defined to efficiently
      check for known scopes without comparing strings;
    - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
      the bitcode.

Differential Revision: https://reviews.llvm.org/D21723

llvm-svn: 307722
69 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/CodeGen/MachineMemOperand.h
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/include/llvm/IR/IRBuilder.h
llvm/include/llvm/IR/Instructions.h
llvm/include/llvm/IR/LLVMContext.h
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/AsmParser/LLParser.h
llvm/lib/AsmParser/LLToken.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AtomicExpandPass.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/MIRParser/MILexer.cpp
llvm/lib/CodeGen/MIRParser/MILexer.h
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/lib/CodeGen/MIRPrinter.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/Instruction.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/IR/LLVMContext.cpp
llvm/lib/IR/LLVMContextImpl.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/lib/Transforms/Utils/FunctionComparator.cpp
llvm/test/Assembler/atomic.ll
llvm/test/Bitcode/atomic-no-syncscope.ll [new file with mode: 0644]
llvm/test/Bitcode/atomic-no-syncscope.ll.bc [new file with mode: 0644]
llvm/test/Bitcode/atomic.ll
llvm/test/Bitcode/compatibility-3.6.ll
llvm/test/Bitcode/compatibility-3.7.ll
llvm/test/Bitcode/compatibility-3.8.ll
llvm/test/Bitcode/compatibility-3.9.ll
llvm/test/Bitcode/compatibility-4.0.ll
llvm/test/Bitcode/compatibility.ll
llvm/test/Bitcode/memInstructions.3.2.ll
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
llvm/test/CodeGen/AArch64/fence-singlethread.ll
llvm/test/CodeGen/AMDGPU/syncscopes.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/fence-singlethread.ll
llvm/test/CodeGen/MIR/AArch64/atomic-memoperands.mir
llvm/test/CodeGen/MIR/AMDGPU/syncscopes.mir [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/atomics-regression.ll
llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
llvm/test/Linker/Inputs/syncscope-1.ll [new file with mode: 0644]
llvm/test/Linker/Inputs/syncscope-2.ll [new file with mode: 0644]
llvm/test/Linker/syncscopes.ll [new file with mode: 0644]
llvm/test/Transforms/GVN/PRE/atomic.ll
llvm/test/Transforms/InstCombine/consecutive-fences.ll
llvm/test/Transforms/Sink/fence.ll
llvm/unittests/Analysis/AliasAnalysisTest.cpp