[PATCH] D11580: [InstrProfiling] Update test cases for using "atomicrmw add" to increment counters.

Justin Bogner mail at justinbogner.com
Wed Jul 29 16:47:13 PDT 2015


Alexey Samsonov <vonosmas at gmail.com> writes:
> samsonov created this revision.
> samsonov added reviewers: dnovillo, bogner.
> samsonov added a subscriber: cfe-commits.
>
> This patch is generated by running "s/store/atomicrmw add/".
> As a side note, it's sort of unfortunate that LLVM-specific code
> (InstrProfiling instrumentation) is tests only by Clang testsuite.

These tests can and should be changed to test for the pre-lowered
intrinsics, and we should add tests in llvm that test the actual
lowering of the intrinsics. There wasn't a good way to output IR that
still had the intrinsics when the tests were written, but the
-disable-llvm-passes stevenwu added recently should allow us to clean
this up.

> http://reviews.llvm.org/D11580
>
> Files:
>   test/Profile/c-captured.c
>   test/Profile/c-general.c
>   test/Profile/c-unreachable-after-switch.c
>   test/Profile/cxx-class.cpp
>   test/Profile/cxx-lambda.cpp
>   test/Profile/cxx-rangefor.cpp
>   test/Profile/cxx-templates.cpp
>   test/Profile/cxx-throws.cpp
>   test/Profile/objc-general.m
>
> Index: test/Profile/objc-general.m
> ===================================================================
> --- test/Profile/objc-general.m
> +++ test/Profile/objc-general.m
> @@ -42,19 +42,19 @@
>  @implementation A
>  // PGOGEN: define {{.*}}+[A foreach:]
>  // PGOUSE: define {{.*}}+[A foreach:]
> -// PGOGEN: store {{.*}} @[[FRC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[FRC]], i64 0, i64 0
>  + (void)foreach: (NSArray *)array
>  {
>    __block id result;
> -  // PGOGEN: store {{.*}} @[[FRC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[FRC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[FR1:[0-9]+]]
>    // PGOUSE: br {{.*}} !prof ![[FR2:[0-9]+]]
>    for (id x in array) {
>      // PGOGEN: define {{.*}}_block_invoke
>      // PGOUSE: define {{.*}}_block_invoke
> -    // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 0
> +    // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 0
>      ^{ static int init = 0;
> -      // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 1
> +      // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 1
>        // PGOUSE: br {{.*}} !prof ![[BL1:[0-9]+]]
>         if (init)
>           result = x;
> Index: test/Profile/cxx-throws.cpp
> ===================================================================
> --- test/Profile/cxx-throws.cpp
> +++ test/Profile/cxx-throws.cpp
> @@ -16,16 +16,16 @@
>  
>  // PGOGEN-LABEL: @_Z6throwsv()
>  // PGOUSE-LABEL: @_Z6throwsv()
> -// PGOGEN: store {{.*}} @[[THC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 0
>  void throws() {
> -  // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[TH1:[0-9]+]]
>    for (int i = 0; i < 100; ++i) {
>      try {
> -      // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 3
> +      // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 3
>        // PGOUSE: br {{.*}} !prof ![[TH2:[0-9]+]]
>        if (i % 3) {
> -        // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 4
> +        // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 4
>          // PGOUSE: br {{.*}} !prof ![[TH3:[0-9]+]]
>          if (i < 50)
>            throw 1;
> @@ -36,23 +36,23 @@
>          // PGOUSE: if.else{{.*}}:
>          // PGOGEN: if.else{{.*}}:
>  
> -        // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 5
> +        // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 5
>          // PGOUSE: br {{.*}} !prof ![[TH4:[0-9]+]]
>          if (i >= 50)
>            throw 0;
>        }
>      } catch (int e) {
>        // PGOUSE-EXC: catch{{.*}}:
>        // PGOGEN-EXC: catch{{.*}}:
>  
> -      // PGOGEN-EXC: store {{.*}} @[[THC]], i64 0, i64 6
> -      // PGOGEN-EXC: store {{.*}} @[[THC]], i64 0, i64 7
> +      // PGOGEN-EXC: atomicrmw add {{.*}} @[[THC]], i64 0, i64 6
> +      // PGOGEN-EXC: atomicrmw add {{.*}} @[[THC]], i64 0, i64 7
>        // PGOUSE-EXC: br {{.*}} !prof ![[TH5:[0-9]+]]
>        if (e) {}
>      }
> -    // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 2
>  
> -    // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 8
> +    // PGOGEN: atomicrmw add {{.*}} @[[THC]], i64 0, i64 8
>      // PGOUSE: br {{.*}} !prof ![[TH6:[0-9]+]]
>      if (i < 100) {}
>    }
> @@ -63,14 +63,14 @@
>  
>  // PGOGEN-LABEL: @_Z11unreachablei(i32
>  // PGOUSE-LABEL: @_Z11unreachablei(i32
> -// PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[UNC]], i64 0, i64 0
>  void unreachable(int i) {
> -  // PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[UNC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[UN1:[0-9]+]]
>    if (i)
>      throw i;
>  
> -  // PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[UNC]], i64 0, i64 2
>    // Since we never reach here, the weights should all be zero (and skipped)
>    // PGOUSE-NOT: br {{.*}} !prof !{{.*}}
>    if (i) {}
> Index: test/Profile/cxx-templates.cpp
> ===================================================================
> --- test/Profile/cxx-templates.cpp
> +++ test/Profile/cxx-templates.cpp
> @@ -19,13 +19,13 @@
>  // T100USE-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj100EEvv()
>  template <unsigned N> void loop() {
>    // ALL-NOT: ret
> -  // T0GEN: store {{.*}} @[[T0C]], i64 0, i64 0
> -  // T100GEN: store {{.*}} @[[T100C]], i64 0, i64 0
> +  // T0GEN: atomicrmw add {{.*}} @[[T0C]], i64 0, i64 0
> +  // T100GEN: atomicrmw add {{.*}} @[[T100C]], i64 0, i64 0
>  
>    // ALL-NOT: ret
> -  // T0GEN: store {{.*}} @[[T0C]], i64 0, i64 1
> +  // T0GEN: atomicrmw add {{.*}} @[[T0C]], i64 0, i64 1
>    // T0USE: br {{.*}} !prof ![[T01:[0-9]+]]
> -  // T100GEN: store {{.*}} @[[T100C]], i64 0, i64 1
> +  // T100GEN: atomicrmw add {{.*}} @[[T100C]], i64 0, i64 1
>    // T100USE: br {{.*}} !prof ![[T1001:[0-9]+]]
>    for (unsigned I = 0; I < N; ++I) {}
>  
> Index: test/Profile/cxx-rangefor.cpp
> ===================================================================
> --- test/Profile/cxx-rangefor.cpp
> +++ test/Profile/cxx-rangefor.cpp
> @@ -10,25 +10,25 @@
>  // PGOGEN: @[[RFC:__llvm_profile_counters__Z9range_forv]] = private global [5 x i64] zeroinitializer
>  
>  // CHECK-LABEL: define {{.*}}void @_Z9range_forv()
> -// PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[RFC]], i64 0, i64 0
>  void range_for() {
>    int arr[] = {1, 2, 3, 4, 5};
>    int sum = 0;
> -  // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[RFC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[RF1:[0-9]+]]
>    for (auto i : arr) {
> -    // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[RFC]], i64 0, i64 2
>      // PGOUSE: br {{.*}} !prof ![[RF2:[0-9]+]]
>      if (i == 3)
>        continue;
>      sum += i;
> -    // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 3
> +    // PGOGEN: atomicrmw add {{.*}} @[[RFC]], i64 0, i64 3
>      // PGOUSE: br {{.*}} !prof ![[RF3:[0-9]+]]
>      if (sum >= 7)
>        break;
>    }
>  
> -  // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 4
> +  // PGOGEN: atomicrmw add {{.*}} @[[RFC]], i64 0, i64 4
>    // PGOUSE: br {{.*}} !prof ![[RF4:[0-9]+]]
>    if (sum) {}
>  }
> Index: test/Profile/cxx-lambda.cpp
> ===================================================================
> --- test/Profile/cxx-lambda.cpp
> +++ test/Profile/cxx-lambda.cpp
> @@ -15,32 +15,32 @@
>  
>  // PGOGEN-LABEL: define {{.*}}void @_Z7lambdasv()
>  // PGOUSE-LABEL: define {{.*}}void @_Z7lambdasv()
> -// PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[LWC]], i64 0, i64 0
>  void lambdas() {
>    int i = 1;
>  
>    // LMBGEN-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"(
>    // LMBUSE-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"(
> -  // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 0
> +  // LMBGEN: atomicrmw add {{.*}} @[[LFC]], i64 0, i64 0
>    auto f = [&i](int k) {
> -    // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 1
> +    // LMBGEN: atomicrmw add {{.*}} @[[LFC]], i64 0, i64 1
>      // LMBUSE: br {{.*}} !prof ![[LF1:[0-9]+]]
>      if (i > 0) {}
> -    // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 2
> +    // LMBGEN: atomicrmw add {{.*}} @[[LFC]], i64 0, i64 2
>      // LMBUSE: br {{.*}} !prof ![[LF2:[0-9]+]]
>      return k && i;
>    };
>  
> -  // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[LWC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[LW1:[0-9]+]]
>    if (i) {}
>  
> -  // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[LWC]], i64 0, i64 2
>    // PGOUSE: br {{.*}} !prof ![[LW2:[0-9]+]]
>    for (i = 0; i < 10; ++i)
>      f(9 - i);
>  
> -  // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 3
> +  // PGOGEN: atomicrmw add {{.*}} @[[LWC]], i64 0, i64 3
>    // PGOUSE: br {{.*}} !prof ![[LW3:[0-9]+]]
>    if (i) {}
>  }
> Index: test/Profile/cxx-class.cpp
> ===================================================================
> --- test/Profile/cxx-class.cpp
> +++ test/Profile/cxx-class.cpp
> @@ -18,55 +18,55 @@
>  public:
>    // CTRGEN-LABEL: define {{.*}} @_ZN6SimpleC2Ei(
>    // CTRUSE-LABEL: define {{.*}} @_ZN6SimpleC2Ei(
> -  // CTRGEN: store {{.*}} @[[SCC:__llvm_profile_counters__ZN6SimpleC2Ei]], i64 0, i64 0
> +  // CTRGEN: atomicrmw add {{.*}} @[[SCC:__llvm_profile_counters__ZN6SimpleC2Ei]], i64 0, i64 0
>    explicit Simple(int Member) : Member(Member) {
> -    // CTRGEN: store {{.*}} @[[SCC]], i64 0, i64 1
> +    // CTRGEN: atomicrmw add {{.*}} @[[SCC]], i64 0, i64 1
>      // CTRUSE: br {{.*}} !prof ![[SC1:[0-9]+]]
>      if (Member) {}
> -    // CTRGEN-NOT: store {{.*}} @[[SCC]],
> +    // CTRGEN-NOT: atomicrmw add {{.*}} @[[SCC]],
>      // CTRUSE-NOT: br {{.*}} !prof ![0-9]+
>      // CTRUSE: ret
>    }
>    // CTRUSE: ![[SC1]] = !{!"branch_weights", i32 100, i32 2}
>  
>    // DTRGEN-LABEL: define {{.*}} @_ZN6SimpleD2Ev(
>    // DTRUSE-LABEL: define {{.*}} @_ZN6SimpleD2Ev(
> -  // DTRGEN: store {{.*}} @[[SDC:__llvm_profile_counters__ZN6SimpleD2Ev]], i64 0, i64 0
> +  // DTRGEN: atomicrmw add {{.*}} @[[SDC:__llvm_profile_counters__ZN6SimpleD2Ev]], i64 0, i64 0
>    ~Simple() {
> -    // DTRGEN: store {{.*}} @[[SDC]], i64 0, i64 1
> +    // DTRGEN: atomicrmw add {{.*}} @[[SDC]], i64 0, i64 1
>      // DTRUSE: br {{.*}} !prof ![[SD1:[0-9]+]]
>      if (Member) {}
> -    // DTRGEN-NOT: store {{.*}} @[[SDC]],
> +    // DTRGEN-NOT: atomicrmw add {{.*}} @[[SDC]],
>      // DTRUSE-NOT: br {{.*}} !prof ![0-9]+
>      // DTRUSE: ret
>    }
>    // DTRUSE: ![[SD1]] = !{!"branch_weights", i32 100, i32 2}
>  
>    // MTHGEN-LABEL: define {{.*}} @_ZN6Simple6methodEv(
>    // MTHUSE-LABEL: define {{.*}} @_ZN6Simple6methodEv(
> -  // MTHGEN: store {{.*}} @[[SMC:__llvm_profile_counters__ZN6Simple6methodEv]], i64 0, i64 0
> +  // MTHGEN: atomicrmw add {{.*}} @[[SMC:__llvm_profile_counters__ZN6Simple6methodEv]], i64 0, i64 0
>    void method() {
> -    // MTHGEN: store {{.*}} @[[SMC]], i64 0, i64 1
> +    // MTHGEN: atomicrmw add {{.*}} @[[SMC]], i64 0, i64 1
>      // MTHUSE: br {{.*}} !prof ![[SM1:[0-9]+]]
>      if (Member) {}
> -    // MTHGEN-NOT: store {{.*}} @[[SMC]],
> +    // MTHGEN-NOT: atomicrmw add {{.*}} @[[SMC]],
>      // MTHUSE-NOT: br {{.*}} !prof ![0-9]+
>      // MTHUSE: ret
>    }
>    // MTHUSE: ![[SM1]] = !{!"branch_weights", i32 100, i32 2}
>  };
>  
>  // WRPGEN-LABEL: define {{.*}} @_Z14simple_wrapperv(
>  // WRPUSE-LABEL: define {{.*}} @_Z14simple_wrapperv(
> -// WRPGEN: store {{.*}} @[[SWC:__llvm_profile_counters__Z14simple_wrapperv]], i64 0, i64 0
> +// WRPGEN: atomicrmw add {{.*}} @[[SWC:__llvm_profile_counters__Z14simple_wrapperv]], i64 0, i64 0
>  void simple_wrapper() {
> -  // WRPGEN: store {{.*}} @[[SWC]], i64 0, i64 1
> +  // WRPGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 1
>    // WRPUSE: br {{.*}} !prof ![[SW1:[0-9]+]]
>    for (int I = 0; I < 100; ++I) {
>      Simple S(I);
>      S.method();
>    }
> -  // WRPGEN-NOT: store {{.*}} @[[SWC]],
> +  // WRPGEN-NOT: atomicrmw add {{.*}} @[[SWC]],
>    // WRPUSE-NOT: br {{.*}} !prof ![0-9]+
>    // WRPUSE: ret
>  }
> Index: test/Profile/c-unreachable-after-switch.c
> ===================================================================
> --- test/Profile/c-unreachable-after-switch.c
> +++ test/Profile/c-unreachable-after-switch.c
> @@ -3,13 +3,13 @@
>  // CHECK: @[[C:__llvm_profile_counters_foo]] = private global [3 x i64] zeroinitializer
>  
>  // CHECK-LABEL: @foo()
> -// CHECK: store {{.*}} @[[C]], i64 0, i64 0
> +// CHECK: atomicrmw add {{.*}} @[[C]], i64 0, i64 0
>  void foo() {
> -  // CHECK: store {{.*}} @[[C]], i64 0, i64 2
> +  // CHECK: atomicrmw add {{.*}} @[[C]], i64 0, i64 2
>    switch (0) {
>    default:
>      return;
>    }
>    // We shouldn't emit the unreachable counter. This used to crash in GlobalDCE.
> -  // CHECK-NOT: store {{.*}} @[[SWC]], i64 0, i64 1}
> +  // CHECK-NOT: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 1}
>  }
> Index: test/Profile/c-general.c
> ===================================================================
> --- test/Profile/c-general.c
> +++ test/Profile/c-general.c
> @@ -23,434 +23,434 @@
>  
>  // PGOGEN-LABEL: @simple_loops()
>  // PGOUSE-LABEL: @simple_loops()
> -// PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[SLC]], i64 0, i64 0
>  void simple_loops() {
>    int i;
> -  // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[SLC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[SL1:[0-9]+]]
>    for (i = 0; i < 100; ++i) {
>    }
> -  // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[SLC]], i64 0, i64 2
>    // PGOUSE: br {{.*}} !prof ![[SL2:[0-9]+]]
>    while (i > 0)
>      i--;
> -  // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 3
> +  // PGOGEN: atomicrmw add {{.*}} @[[SLC]], i64 0, i64 3
>    // PGOUSE: br {{.*}} !prof ![[SL3:[0-9]+]]
>    do {} while (i++ < 75);
>  
> -  // PGOGEN-NOT: store {{.*}} @[[SLC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[SLC]]
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @conditionals()
>  // PGOUSE-LABEL: @conditionals()
> -// PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 0
>  void conditionals() {
> -  // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[IF1:[0-9]+]]
>    for (int i = 0; i < 100; ++i) {
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 2
>      // PGOUSE: br {{.*}} !prof ![[IF2:[0-9]+]]
>      if (i % 2) {
> -      // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 3
> +      // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 3
>        // PGOUSE: br {{.*}} !prof ![[IF3:[0-9]+]]
>        if (i) {}
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 4
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 4
>      // PGOUSE: br {{.*}} !prof ![[IF4:[0-9]+]]
>      } else if (i % 3) {
> -      // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 5
> +      // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 5
>        // PGOUSE: br {{.*}} !prof ![[IF5:[0-9]+]]
>        if (i) {}
>      } else {
> -      // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 6
> +      // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 6
>        // PGOUSE: br {{.*}} !prof ![[IF6:[0-9]+]]
>        if (i) {}
>      }
>  
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 8
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 8
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 7
>      // PGOUSE: br {{.*}} !prof ![[IF7:[0-9]+]]
>      if (1 && i) {}
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 10
> -    // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 9
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 10
> +    // PGOGEN: atomicrmw add {{.*}} @[[IFC]], i64 0, i64 9
>      // PGOUSE: br {{.*}} !prof ![[IF8:[0-9]+]]
>      if (0 || i) {}
>    }
>  
> -  // PGOGEN-NOT: store {{.*}} @[[IFC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[IFC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @early_exits()
>  // PGOUSE-LABEL: @early_exits()
> -// PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 0
>  void early_exits() {
>    int i = 0;
>  
> -  // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[EE1:[0-9]+]]
>    if (i) {}
>  
> -  // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 2
>    // PGOUSE: br {{.*}} !prof ![[EE2:[0-9]+]]
>    while (i < 100) {
>      i++;
> -    // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 3
> +    // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 3
>      // PGOUSE: br {{.*}} !prof ![[EE3:[0-9]+]]
>      if (i > 50)
>        break;
> -    // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 4
> +    // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 4
>      // PGOUSE: br {{.*}} !prof ![[EE4:[0-9]+]]
>      if (i % 2)
>        continue;
>    }
>  
> -  // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 5
> +  // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 5
>    // PGOUSE: br {{.*}} !prof ![[EE5:[0-9]+]]
>    if (i) {}
>  
> -  // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 6
> +  // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 6
>    do {
> -    // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 7
>      // PGOUSE: br {{.*}} !prof ![[EE6:[0-9]+]]
>      if (i > 75)
>        return;
>      else
>        i++;
>    // PGOUSE: br {{.*}} !prof ![[EE7:[0-9]+]]
>    } while (i < 100);
>  
> -  // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 8
> +  // PGOGEN: atomicrmw add {{.*}} @[[EEC]], i64 0, i64 8
>    // Never reached -> no weights
>    if (i) {}
>  
> -  // PGOGEN-NOT: store {{.*}} @[[EEC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[EEC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @jumps()
>  // PGOUSE-LABEL: @jumps()
> -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 0
>  void jumps() {
>    int i;
>  
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[JM1:[0-9]+]]
>    for (i = 0; i < 2; ++i) {
>      goto outofloop;
>      // Never reached -> no weights
>      if (i) {}
>    }
> -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 3
> +// PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 3
>  outofloop:
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 4
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 4
>    // PGOUSE: br {{.*}} !prof ![[JM2:[0-9]+]]
>    if (i) {}
>  
>    goto loop1;
>  
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 5
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 5
>    // PGOUSE: br {{.*}} !prof ![[JM3:[0-9]+]]
>    while (i) {
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 6
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 6
>    loop1:
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 7
>      // PGOUSE: br {{.*}} !prof ![[JM4:[0-9]+]]
>      if (i) {}
>    }
>  
>    goto loop2;
> -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 8
> +// PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 8
>  first:
> -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 9
> +// PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 9
>  second:
> -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 10
> +// PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 10
>  third:
>    i++;
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 11
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 11
>    // PGOUSE: br {{.*}} !prof ![[JM5:[0-9]+]]
>    if (i < 3)
>      goto loop2;
>  
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 12
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 12
>    // PGOUSE: br {{.*}} !prof ![[JM6:[0-9]+]]
>    while (i < 3) {
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 13
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 13
>    loop2:
>      // PGOUSE: switch {{.*}} [
>      // PGOUSE: ], !prof ![[JM7:[0-9]+]]
>      switch (i) {
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 15
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 15
>      case 0:
>        goto first;
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 16
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 16
>      case 1:
>        goto second;
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 17
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 17
>      case 2:
>        goto third;
>      }
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 14
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 14
>    }
>  
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 18
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 18
>    // PGOUSE: br {{.*}} !prof ![[JM8:[0-9]+]]
>    for (i = 0; i < 10; ++i) {
>      goto withinloop;
>      // never reached -> no weights
>      if (i) {}
> -  // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 20
> +  // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 20
>    withinloop:
> -    // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 21
> +    // PGOGEN: atomicrmw add {{.*}} @[[JMC]], i64 0, i64 21
>      // PGOUSE: br {{.*}} !prof ![[JM9:[0-9]+]]
>      if (i) {}
>    }
>  
> -  // PGOGEN-NOT: store {{.*}} @[[JMC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[JMC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @switches()
>  // PGOUSE-LABEL: @switches()
> -// PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 0
>  void switches() {
>    static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
>  
>    // No cases -> no weights
>    switch (weights[0]) {
> -  // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 2
>    default:
>      break;
>    }
> -  // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 1
>  
> -  // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 3
> +  // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 3
>    // PGOUSE: br {{.*}} !prof ![[SW1:[0-9]+]]
>    for (int i = 0, len = sizeof(weights) / sizeof(weights[0]); i < len; ++i) {
>      // PGOUSE: switch {{.*}} [
>      // PGOUSE: ], !prof ![[SW2:[0-9]+]]
>      switch (i[weights]) {
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 5
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 5
>      case 1:
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 6
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 6
>        // PGOUSE: br {{.*}} !prof ![[SW3:[0-9]+]]
>        if (i) {}
>        // fallthrough
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 7
>      case 2:
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 8
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 8
>        // PGOUSE: br {{.*}} !prof ![[SW4:[0-9]+]]
>        if (i) {}
>        break;
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 9
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 9
>      case 3:
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 10
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 10
>        // PGOUSE: br {{.*}} !prof ![[SW5:[0-9]+]]
>        if (i) {}
>        continue;
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 11
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 11
>      case 4:
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 12
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 12
>        // PGOUSE: br {{.*}} !prof ![[SW6:[0-9]+]]
>        if (i) {}
>        // PGOUSE: switch {{.*}} [
>        // PGOUSE: ], !prof ![[SW7:[0-9]+]]
>        switch (i) {
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 14
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 14
>        case 6 ... 9:
> -        // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 15
> +        // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 15
>          // PGOUSE: br {{.*}} !prof ![[SW8:[0-9]+]]
>          if (i) {}
>          continue;
>        }
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 13
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 13
>  
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 16
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 16
>      default:
> -      // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 17
> +      // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 17
>        // PGOUSE: br {{.*}} !prof ![[SW9:[0-9]+]]
>        if (i == len - 1)
>          return;
>      }
> -    // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 4
> +    // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 4
>    }
>  
> -  // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 18
> +  // PGOGEN: atomicrmw add {{.*}} @[[SWC]], i64 0, i64 18
>    // Never reached -> no weights
>    if (weights[0]) {}
>  
> -  // PGOGEN-NOT: store {{.*}} @[[SWC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[SWC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @big_switch()
>  // PGOUSE-LABEL: @big_switch()
> -// PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 0
>  void big_switch() {
> -  // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[BS1:[0-9]+]]
>    for (int i = 0; i < 32; ++i) {
>      // PGOUSE: switch {{.*}} [
>      // PGOUSE: ], !prof ![[BS2:[0-9]+]]
>      switch (1 << i) {
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 3
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 3
>      case (1 << 0):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 4
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 4
>        // PGOUSE: br {{.*}} !prof ![[BS3:[0-9]+]]
>        if (i) {}
>        // fallthrough
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 5
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 5
>      case (1 << 1):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 6
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 6
>        // PGOUSE: br {{.*}} !prof ![[BS4:[0-9]+]]
>        if (i) {}
>        break;
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 7
>      case (1 << 2) ... (1 << 12):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 8
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 8
>        // PGOUSE: br {{.*}} !prof ![[BS5:[0-9]+]]
>        if (i) {}
>        break;
>      // The branch for the large case range above appears after the case body
>      // PGOUSE: br {{.*}} !prof ![[BS6:[0-9]+]]
>  
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 9
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 9
>      case (1 << 13):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 10
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 10
>        // PGOUSE: br {{.*}} !prof ![[BS7:[0-9]+]]
>        if (i) {}
>        break;
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 11
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 11
>      case (1 << 14) ... (1 << 28):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 12
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 12
>        // PGOUSE: br {{.*}} !prof ![[BS8:[0-9]+]]
>        if (i) {}
>        break;
>      // The branch for the large case range above appears after the case body
>      // PGOUSE: br {{.*}} !prof ![[BS9:[0-9]+]]
>  
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 13
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 13
>      case (1 << 29) ... ((1 << 29) + 1):
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 14
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 14
>        // PGOUSE: br {{.*}} !prof ![[BS10:[0-9]+]]
>        if (i) {}
>        break;
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 15
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 15
>      default:
> -      // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 16
> +      // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 16
>        // PGOUSE: br {{.*}} !prof ![[BS11:[0-9]+]]
>        if (i) {}
>        break;
>      }
> -    // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[BSC]], i64 0, i64 2
>    }
>  
> -  // PGOGEN-NOT: store {{.*}} @[[BSC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[BSC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>    // PGOUSE: ret void
>  }
>  
>  // PGOGEN-LABEL: @boolean_operators()
>  // PGOUSE-LABEL: @boolean_operators()
> -// PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 0
>  void boolean_operators() {
>    int v;
> -  // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[BO1:[0-9]+]]
>    for (int i = 0; i < 100; ++i) {
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 2
>      // PGOUSE: br {{.*}} !prof ![[BO2:[0-9]+]]
>      v = i % 3 || i;
>  
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 3
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 3
>      // PGOUSE: br {{.*}} !prof ![[BO3:[0-9]+]]
>      v = i % 3 && i;
>  
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 5
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 4
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 5
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 4
>      // PGOUSE: br {{.*}} !prof ![[BO4:[0-9]+]]
>      // PGOUSE: br {{.*}} !prof ![[BO5:[0-9]+]]
>      v = i % 3 || i % 2 || i;
>  
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 7
> -    // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 6
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 7
> +    // PGOGEN: atomicrmw add {{.*}} @[[BOC]], i64 0, i64 6
>      // PGOUSE: br {{.*}} !prof ![[BO6:[0-9]+]]
>      // PGOUSE: br {{.*}} !prof ![[BO7:[0-9]+]]
>      v = i % 2 && i % 3 && i;
>    }
>  
> -  // PGOGEN-NOT: store {{.*}} @[[BOC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[BOC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @boolop_loops()
>  // PGOUSE-LABEL: @boolop_loops()
> -// PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 0
>  void boolop_loops() {
>    int i = 100;
>  
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 2
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[BL1:[0-9]+]]
>    // PGOUSE: br {{.*}} !prof ![[BL2:[0-9]+]]
>    while (i && i > 50)
>      i--;
>  
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 4
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 3
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 4
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 3
>    // PGOUSE: br {{.*}} !prof ![[BL3:[0-9]+]]
>    // PGOUSE: br {{.*}} !prof ![[BL4:[0-9]+]]
>    while ((i % 2) || (i > 0))
>      i--;
>  
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 6
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 5
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 6
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 5
>    // PGOUSE: br {{.*}} !prof ![[BL5:[0-9]+]]
>    // PGOUSE: br {{.*}} !prof ![[BL6:[0-9]+]]
>    for (i = 100; i && i > 50; --i);
>  
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 8
> -  // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 7
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 8
> +  // PGOGEN: atomicrmw add {{.*}} @[[BLC]], i64 0, i64 7
>    // PGOUSE: br {{.*}} !prof ![[BL7:[0-9]+]]
>    // PGOUSE: br {{.*}} !prof ![[BL8:[0-9]+]]
>    for (; (i % 2) || (i > 0); --i);
>  
> -  // PGOGEN-NOT: store {{.*}} @[[BLC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[BLC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @conditional_operator()
>  // PGOUSE-LABEL: @conditional_operator()
> -// PGOGEN: store {{.*}} @[[COC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[COC]], i64 0, i64 0
>  void conditional_operator() {
>    int i = 100;
>  
> -  // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[COC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[CO1:[0-9]+]]
>    int j = i < 50 ? i : 1;
>  
> -  // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[COC]], i64 0, i64 2
>    // PGOUSE: br {{.*}} !prof ![[CO2:[0-9]+]]
>    int k = i ?: 0;
>  
> -  // PGOGEN-NOT: store {{.*}} @[[COC]],
> +  // PGOGEN-NOT: atomicrmw add {{.*}} @[[COC]],
>    // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
>  }
>  
>  // PGOGEN-LABEL: @do_fallthrough()
>  // PGOUSE-LABEL: @do_fallthrough()
> -// PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[DFC]], i64 0, i64 0
>  void do_fallthrough() {
> -  // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[DFC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[DF1:[0-9]+]]
>    for (int i = 0; i < 10; ++i) {
>      int j = 0;
> -    // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[DFC]], i64 0, i64 2
>      do {
>        // The number of exits out of this do-loop via the break statement
>        // exceeds the counter value for the loop (which does not include the
>        // fallthrough count). Make sure that does not violate any assertions.
> -      // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 3
> +      // PGOGEN: atomicrmw add {{.*}} @[[DFC]], i64 0, i64 3
>        // PGOUSE: br {{.*}} !prof ![[DF3:[0-9]+]]
>        if (i < 8) break;
>        j++;
> @@ -461,9 +461,9 @@
>  
>  // PGOGEN-LABEL: @static_func()
>  // PGOUSE-LABEL: @static_func()
> -// PGOGEN: store {{.*}} @[[STC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[STC]], i64 0, i64 0
>  static void static_func() {
> -  // PGOGEN: store {{.*}} @[[STC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[STC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]]
>    for (int i = 0; i < 10; ++i) {
>    }
> Index: test/Profile/c-captured.c
> ===================================================================
> --- test/Profile/c-captured.c
> +++ test/Profile/c-captured.c
> @@ -8,37 +8,37 @@
>  // PGOGEN: @[[C1C:"__llvm_profile_counters_c-captured.c:__captured_stmt.1"]] = private global [3 x i64] zeroinitializer
>  
>  // PGOALL-LABEL: define void @debug_captured()
> -// PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 0
> +// PGOGEN: atomicrmw add {{.*}} @[[DCC]], i64 0, i64 0
>  void debug_captured() {
>    int x = 10;
>  
>    // Check both debug_captured counters, so we can do this all in one pass
> -  // PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 1
> +  // PGOGEN: atomicrmw add {{.*}} @[[DCC]], i64 0, i64 1
>    // PGOUSE: br {{.*}} !prof ![[DC1:[0-9]+]]
> -  // PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 2
> +  // PGOGEN: atomicrmw add {{.*}} @[[DCC]], i64 0, i64 2
>    // PGOUSE: br {{.*}} !prof ![[DC2:[0-9]+]]
>    // PGOALL: ret
>  
>    // PGOALL-LABEL: define internal void @__captured_stmt(
> -  // PGOGEN: store {{.*}} @[[CSC]], i64 0, i64 0
> +  // PGOGEN: atomicrmw add {{.*}} @[[CSC]], i64 0, i64 0
>    #pragma clang __debug captured
>    {
> -    // PGOGEN: store {{.*}} @[[CSC]], i64 0, i64 1
> +    // PGOGEN: atomicrmw add {{.*}} @[[CSC]], i64 0, i64 1
>      // PGOUSE: br {{.*}} !prof ![[CS1:[0-9]+]]
>      if (x) {}
>      // PGOALL: ret
>    }
>  
>    if (x) {} // This is DC1. Checked above.
>  
>    // PGOALL-LABEL: define internal void @__captured_stmt.1(
> -  // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 0
> +  // PGOGEN: atomicrmw add {{.*}} @[[C1C]], i64 0, i64 0
>    #pragma clang __debug captured
>    {
> -    // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 1
> +    // PGOGEN: atomicrmw add {{.*}} @[[C1C]], i64 0, i64 1
>      // PGOUSE: br {{.*}} !prof ![[C11:[0-9]+]]
>      for (int i = 0; i < x; ++i) {}
> -    // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 2
> +    // PGOGEN: atomicrmw add {{.*}} @[[C1C]], i64 0, i64 2
>      // PGOUSE: br {{.*}} !prof ![[C12:[0-9]+]]
>      if (x) {}
>      // PGOALL: ret



More information about the cfe-commits mailing list