[llvm-commits] [llvm] r155698 - in /llvm/trunk: lib/Transforms/Instrumentation/ThreadSanitizer.cpp test/Instrumentation/ThreadSanitizer/atomic.ll

Nick Lewycky nlewycky at google.com
Sat Apr 28 11:34:46 PDT 2012


On 27 April 2012 00:31, Kostya Serebryany <kcc at google.com> wrote:

> Author: kcc
> Date: Fri Apr 27 02:31:53 2012
> New Revision: 155698
>
> URL: http://llvm.org/viewvc/llvm-project?rev=155698&view=rev
> Log:
> [tsan] Atomic support for ThreadSanitizer, patch by  Dmitry Vyukov
>
> Added:
>    llvm/trunk/test/Instrumentation/ThreadSanitizer/atomic.ll
> Modified:
>    llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
>
>

> +static bool isAtomic(Instruction *I) {
> +  if (LoadInst *LI = dyn_cast<LoadInst>(I))
> +    return LI->isAtomic() && LI->getSynchScope() == CrossThread;
> +  else if (StoreInst *SI = dyn_cast<StoreInst>(I))
> +    return SI->isAtomic() && SI->getSynchScope() == CrossThread;
> +  else if (isa<AtomicRMWInst>(I))
> +    return true;
> +  else if (isa<AtomicCmpXchgInst>(I))
> +    return true;
> +  else if (FenceInst *FI = dyn_cast<FenceInst>(I))
> +    return FI->getSynchScope() == CrossThread;
> +  return false;
> +}
>

Style nitpick: don't use else after return.
http://llvm.org/docs/CodingStandards.html#hl_else_after_return

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120428/4e6f399d/attachment.html>


More information about the llvm-commits mailing list