<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Patch posted for review as: <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D24365">https://reviews.llvm.org/D24365</a><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 09/08/2016 12:02 PM, Philip Reames
      via llvm-commits wrote:<br>
    </div>
    <blockquote
      cite="mid:146c10fe-63c9-bedb-5130-201cb4079f1c@philipreames.com"
      type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <p>I haven't gotten a lot of time to look at this, but I'm
        thinking about two options:</p>
      <p>1) Allow atomic vector types.  There's a solid argument that
        this is a useful canonicalization.  Adding the lowering in
        AtomicExpand would be fairly straight forward.  I think this is
        the right long term approach.  <br>
      </p>
      <p>2) Disallow conversion to atomic vector types.  This is the
        more obvious fix, but the actual code in question is slightly
        complicated.  My first look made it seem like this would be the
        wrong approach, but glancing at this again while I write this, I
        think I was being a bit too pessimistic.  Preparing a patch that
        does this seems much less invasive than I first thought.</p>
      <p>My current plan is to prepare a patch for approach 2.  I may
        get to this today.  If not, I will make a point of getting this
        done over the weekend.  Sorry for the delay.<br>
      </p>
      <p>Philip<br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 09/07/2016 02:18 PM, Steven Wu
        wrote:<br>
      </div>
      <blockquote
        cite="mid:EDF00EB3-68BA-43E0-AF6F-D238744BBC43@apple.com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        Ping. Is there any update for this? 
        <div class=""><br class="">
        </div>
        <div class=""><br class="">
          <div>
            <blockquote type="cite" class="">
              <div class="">On Aug 24, 2016, at 9:00 AM, Steven Wu <<a
                  moz-do-not-send="true"
                  href="mailto:stevenwu@apple.com" class="">stevenwu@apple.com</a>>
                wrote:</div>
              <br class="Apple-interchange-newline">
              <div class="">
                <blockquote type="cite" class="" style="font-family:
                  Helvetica; font-size: 12px; font-style: normal;
                  font-variant-caps: normal; font-weight: normal;
                  letter-spacing: normal; orphans: auto; text-align:
                  start; text-indent: 0px; text-transform: none;
                  white-space: normal; widows: auto; word-spacing: 0px;
                  -webkit-text-size-adjust: auto;
                  -webkit-text-stroke-width: 0px;">
                  <div class=""><br class="Apple-interchange-newline">
                    On Aug 23, 2016, at 5:02 PM, Philip Reames <<a
                      moz-do-not-send="true"
                      href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>>
                    wrote:</div>
                  <br class="Apple-interchange-newline">
                  <div class=""><span class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px; float: none;
                      display: inline !important;">On 08/23/2016 04:21
                      PM, Steven Wu wrote:</span><br class=""
                      style="font-family: Helvetica; font-size: 12px;
                      font-style: normal; font-variant-caps: normal;
                      font-weight: normal; letter-spacing: normal;
                      orphans: auto; text-align: start; text-indent:
                      0px; text-transform: none; white-space: normal;
                      widows: auto; word-spacing: 0px;
                      -webkit-text-stroke-width: 0px;">
                    <blockquote type="cite" class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;">Hi Philip<br
                        class="">
                      <br class="">
                      I found a fallout of this commit. After this
                      commit, instcombine can create atomic loads/stores
                      on vector types which will be rejected by the
                      verifier. Here is a patch and reproducer as
                      testcase.<br class="">
                      Please let me know what do you think:<br class="">
                    </blockquote>
                    <span class="" style="font-family: Helvetica;
                      font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px; float: none;
                      display: inline !important;">Can you file a bug
                      for this with your test cases?  I'll look at this
                      tomorrow.</span><br class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;">
                  </div>
                </blockquote>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class=""><br class="">
                </div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class="">File PR29121 and I cc you in the bug. </div>
                <br class="" style="font-family: Helvetica; font-size:
                  12px; font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;">
                <blockquote type="cite" class="" style="font-family:
                  Helvetica; font-size: 12px; font-style: normal;
                  font-variant-caps: normal; font-weight: normal;
                  letter-spacing: normal; orphans: auto; text-align:
                  start; text-indent: 0px; text-transform: none;
                  white-space: normal; widows: auto; word-spacing: 0px;
                  -webkit-text-size-adjust: auto;
                  -webkit-text-stroke-width: 0px;">
                  <div class=""><br class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;">
                    <span class="" style="font-family: Helvetica;
                      font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px; float: none;
                      display: inline !important;">I'm not sure your
                      patch is the right direction here.  Using atomic
                      vector in the cases you mentioned actually seem
                      reasonable.  Maybe we should update the
                      AtomicExpand pass and verifier to allow them.</span><br
                      class="" style="font-family: Helvetica; font-size:
                      12px; font-style: normal; font-variant-caps:
                      normal; font-weight: normal; letter-spacing:
                      normal; orphans: auto; text-align: start;
                      text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;">
                    <blockquote type="cite" class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;"><br class="">
                      commit 4cb8f4c4a5f7f92ba8743c23fdc286380dcdbe4d<br
                        class="">
                      Author: Steven Wu <<a moz-do-not-send="true"
                        href="mailto:stevenwu@apple.com" class="">stevenwu@apple.com</a>><br
                        class="">
                      Date:   Tue Aug 23 15:11:29 2016 -0700<br class="">
                      <br class="">
                          [InstCombine] Don't optimize atomic load/store
                      into unsupported types<br class="">
                               According to the bitcode verifier,
                      atomics can only be used on integer, float<br
                        class="">
                          or pointer type. Check the final type before
                      optimize atomic load and store.<br class="">
                      <br class="">
                      diff --git
                      a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br class="">
                      index 1603278..5dbcc79 100644<br class="">
                      ---
                      a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br
                        class="">
                      +++
                      b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br
                        class="">
                      @@ -503,10 +503,15 @@ static Instruction
                      *combineLoadToOperationType(InstCombiner &IC,
                      LoadInst &LI) {<br class="">
                         if (LI.hasOneUse())<br class="">
                           if (auto* CI =
                      dyn_cast<CastInst>(LI.user_back())) {<br
                        class="">
                             if (CI->isNoopCast(DL)) {<br class="">
                      -        LoadInst *NewLoad =
                      combineLoadToNewType(IC, LI, CI->getDestTy());<br
                        class="">
                      -        CI->replaceAllUsesWith(NewLoad);<br
                        class="">
                      -        IC.eraseInstFromFunction(*CI);<br
                        class="">
                      -        return &LI;<br class="">
                      +        // Atomic can only used on integer,
                      pointer or float type.<br class="">
                      +        Type *DestTy = CI->getDestTy();<br
                        class="">
                      +        if (!LI.isAtomic() ||
                      DestTy->isIntegerTy() ||
                      DestTy->isPointerTy() ||<br class="">
                      +            DestTy->isFloatTy()) {<br class="">
                      +          LoadInst *NewLoad =
                      combineLoadToNewType(IC, LI, CI->getDestTy());<br
                        class="">
                      +          CI->replaceAllUsesWith(NewLoad);<br
                        class="">
                      +          IC.eraseInstFromFunction(*CI);<br
                        class="">
                      +          return &LI;<br class="">
                      +        }<br class="">
                             }<br class="">
                           }<br class="">
                       @@ -1001,9 +1006,13 @@ static bool
                      combineStoreToValueType(InstCombiner &IC,
                      StoreInst &SI) {<br class="">
                           // Fold away bit casts of the stored value by
                      storing the original type.<br class="">
                         if (auto *BC = dyn_cast<BitCastInst>(V))
                      {<br class="">
                      -    V = BC->getOperand(0);<br class="">
                      -    combineStoreToNewValue(IC, SI, V);<br
                        class="">
                      -    return true;<br class="">
                      +    Type* SrcTy = BC->getSrcTy();<br class="">
                      +    if (!SI.isAtomic() || SrcTy->isIntegerTy()
                      || SrcTy->isPointerTy() ||<br class="">
                      +        SrcTy->isFloatTy()) {<br class="">
                      +      V = BC->getOperand(0);<br class="">
                      +      combineStoreToNewValue(IC, SI, V);<br
                        class="">
                      +      return true;<br class="">
                      +    }<br class="">
                         }<br class="">
                           if (Value *U = likeBitCastFromVector(IC, V))
                      {<br class="">
                      diff --git a/test/Transforms/InstCombine/atomic.ll
                      b/test/Transforms/InstCombine/atomic.ll<br
                        class="">
                      index 15c1659..ac9792b 100644<br class="">
                      --- a/test/Transforms/InstCombine/atomic.ll<br
                        class="">
                      +++ b/test/Transforms/InstCombine/atomic.ll<br
                        class="">
                      @@ -267,3 +267,25 @@ define void @pr27490b(i8**
                      %p1, i8** %p2) {<br class="">
                         store atomic i8* %l, i8** %p2 seq_cst, align 8<br
                        class="">
                         ret void<br class="">
                       }<br class="">
                      +<br class="">
                      +define <2 x float>
                      @no_atomic_vector_load(i8* %p) {<br class="">
                      +; CHECK-LABEL: define <2 x float>
                      @no_atomic_vector_load(<br class="">
                      +; CHECK-NOT: load atomic <2 x float><br
                        class="">
                      +  %retval = alloca <2 x float>, align 8<br
                        class="">
                      +  %1 = bitcast i8* %p to <2 x float>*<br
                        class="">
                      +  %2 = bitcast <2 x float>* %1 to i64*<br
                        class="">
                      +  %load = load atomic i64, i64* %2 unordered,
                      align 8<br class="">
                      +  %3 = bitcast <2 x float>* %retval to i64*<br
                        class="">
                      +  store i64 %load, i64* %3, align 8<br class="">
                      +  %4 = load <2 x float>, <2 x float>*
                      %retval, align 8<br class="">
                      +  ret <2 x float> %4<br class="">
                      +}<br class="">
                      +<br class="">
                      +define void @no_atomic_vector_store(<2 x
                      float> %p, i8* %p2) {<br class="">
                      +; CHECK-LABEL: define void
                      @no_atomic_vector_store(<br class="">
                      +; CHECK-NOT: store atomic <2 x float><br
                        class="">
                      +  %1 = bitcast <2 x float> %p to i64<br
                        class="">
                      +  %2 = bitcast i8* %p2 to i64*<br class="">
                      +  store atomic i64 %1, i64* %2 unordered, align 8<br
                        class="">
                      +  ret void<br class="">
                      +}<br class="">
                    </blockquote>
                    <span class="" style="font-family: Helvetica;
                      font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px; float: none;
                      display: inline !important;">Ending up with a
                      store atomic <2 x float> seems correct here.
                      What's the reasoning for this being wrong?  Just
                      the verifier failure?</span><br class=""
                      style="font-family: Helvetica; font-size: 12px;
                      font-style: normal; font-variant-caps: normal;
                      font-weight: normal; letter-spacing: normal;
                      orphans: auto; text-align: start; text-indent:
                      0px; text-transform: none; white-space: normal;
                      widows: auto; word-spacing: 0px;
                      -webkit-text-stroke-width: 0px;">
                  </div>
                </blockquote>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class=""><br class="">
                </div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class="">I don't know the background why the
                  verifier reject this specific type but
                  Legalizer/SelectionDAG certainly cannot handle that.
                  It is possible to update the verifier and atomic
                  expand pass to allow that. Since I am not an export in
                  that area, I am just proposing a safer approach. </div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class=""><br class="">
                </div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class="">Thanks</div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class=""><br class="">
                </div>
                <div style="font-family: Helvetica; font-size: 12px;
                  font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;" class="">Steven</div>
                <br class="" style="font-family: Helvetica; font-size:
                  12px; font-style: normal; font-variant-caps: normal;
                  font-weight: normal; letter-spacing: normal; orphans:
                  auto; text-align: start; text-indent: 0px;
                  text-transform: none; white-space: normal; widows:
                  auto; word-spacing: 0px; -webkit-text-stroke-width:
                  0px;">
                <blockquote type="cite" class="" style="font-family:
                  Helvetica; font-size: 12px; font-style: normal;
                  font-variant-caps: normal; font-weight: normal;
                  letter-spacing: normal; orphans: auto; text-align:
                  start; text-indent: 0px; text-transform: none;
                  white-space: normal; widows: auto; word-spacing: 0px;
                  -webkit-text-size-adjust: auto;
                  -webkit-text-stroke-width: 0px;">
                  <div class="">
                    <blockquote type="cite" class="" style="font-family:
                      Helvetica; font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;"><br class="">
                      <br class="">
                      Thanks<br class="">
                      <br class="">
                      Steven<br class="">
                      <br class="">
                      <blockquote type="cite" class="">On May 6, 2016,
                        at 3:17 PM, Philip Reames via llvm-commits <<a
                          moz-do-not-send="true"
                          href="mailto:llvm-commits@lists.llvm.org"
                          class="">llvm-commits@lists.llvm.org</a>>
                        wrote:<br class="">
                        <br class="">
                        Author: reames<br class="">
                        Date: Fri May  6 17:17:01 2016<br class="">
                        New Revision: 268809<br class="">
                        <br class="">
                        URL:<span class="Apple-converted-space"> </span><a
                          moz-do-not-send="true"
                          href="http://llvm.org/viewvc/llvm-project?rev=268809&view=rev"
                          class="">http://llvm.org/viewvc/llvm-project?rev=268809&view=rev</a><br
                          class="">
                        Log:<br class="">
                        Reapply 267210 with fix for PR27490<br class="">
                        <br class="">
                        Original Commit Message<br class="">
                        Extend load/store type canonicalization to
                        handle unordered operations<br class="">
                        <br class="">
                        Extend the type canonicalization logic to work
                        for unordered atomic loads and stores.  Note
                        that while this change itself is fairly simple
                        and low risk, there's a reasonable chance this
                        will expose problems in the backends by suddenly
                        generating IR they wouldn't have seen before.
                         Anything of this nature will be an existing bug
                        in the backend (you could write an atomic float
                        load), but this will definitely change the
                        frequency with which such cases are encountered.
                         If you see problems, feel free to revert this
                        change, but please make sure you collect a test
                        case.<br class="">
                        <br class="">
                        Note that the concern about lowering is now much
                        less likely.  PR27490 proved that we already
                        *were* mucking with the types of ordered atomics
                        and volatiles.  As a result, this change doesn't
                        introduce as much new behavior as originally
                        thought.<br class="">
                        <br class="">
                        <br class="">
                        <br class="">
                        Modified:<br class="">
   llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br
                          class="">
   llvm/trunk/test/Transforms/InstCombine/atomic.ll<br class="">
                        <br class="">
                        Modified:
                        llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br
                          class="">
                        URL:<span class="Apple-converted-space"> </span><a
                          moz-do-not-send="true"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=268809&r1=268808&r2=268809&view=diff"
                          class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=268809&r1=268808&r2=268809&view=diff</a><br
                          class="">
==============================================================================<br
                          class="">
                        ---
                        llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
                        (original)<br class="">
                        +++
                        llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
                        Fri May  6 17:17:01 2016<br class="">
                        @@ -326,7 +326,8 @@ static LoadInst
                        *combineLoadToNewType(In<br class="">
                        <br class="">
                          LoadInst *NewLoad =
                        IC.Builder->CreateAlignedLoad(<br class="">
                              IC.Builder->CreateBitCast(Ptr,
                        NewTy->getPointerTo(AS)),<br class="">
                        -      LI.getAlignment(), LI.getName() +
                        Suffix);<br class="">
                        +      LI.getAlignment(), LI.isVolatile(),
                        LI.getName() + Suffix);<br class="">
                        +  NewLoad->setAtomic(LI.getOrdering(),
                        LI.getSynchScope());<br class="">
                          MDBuilder MDB(NewLoad->getContext());<br
                          class="">
                          for (const auto &MDPair : MD) {<br
                          class="">
                            unsigned ID = MDPair.first;<br class="">
                        @@ -398,7 +399,8 @@ static StoreInst
                        *combineStoreToNewValue<br class="">
                        <br class="">
                          StoreInst *NewStore =
                        IC.Builder->CreateAlignedStore(<br class="">
                              V, IC.Builder->CreateBitCast(Ptr,
                        V->getType()->getPointerTo(AS)),<br
                          class="">
                        -      SI.getAlignment());<br class="">
                        +      SI.getAlignment(), SI.isVolatile());<br
                          class="">
                        +  NewStore->setAtomic(SI.getOrdering(),
                        SI.getSynchScope());<br class="">
                          for (const auto &MDPair : MD) {<br
                          class="">
                            unsigned ID = MDPair.first;<br class="">
                            MDNode *N = MDPair.second;<br class="">
                        @@ -456,9 +458,9 @@ static StoreInst
                        *combineStoreToNewValue<br class="">
                        /// later. However, it is risky in case some
                        backend or other part of LLVM is<br class="">
                        /// relying on the exact type loaded to select
                        appropriate atomic operations.<br class="">
                        static Instruction
                        *combineLoadToOperationType(InstCombiner
                        &IC, LoadInst &LI) {<br class="">
                        -  // FIXME: We could probably with some care
                        handle both volatile and atomic<br class="">
                        -  // loads here but it isn't clear that this is
                        important.<br class="">
                        -  if (!LI.isSimple())<br class="">
                        +  // FIXME: We could probably with some care
                        handle both volatile and ordered<br class="">
                        +  // atomic loads here but it isn't clear that
                        this is important.<br class="">
                        +  if (!LI.isUnordered())<br class="">
                            return nullptr;<br class="">
                        <br class="">
                          if (LI.use_empty())<br class="">
                        @@ -989,9 +991,9 @@ static Value
                        *likeBitCastFromVector(Inst<br class="">
                        /// the store instruction as otherwise there is
                        no way to signal whether it was<br class="">
                        /// combined or not: IC.EraseInstFromFunction
                        returns a null pointer.<br class="">
                        static bool combineStoreToValueType(InstCombiner
                        &IC, StoreInst &SI) {<br class="">
                        -  // FIXME: We could probably with some care
                        handle both volatile and atomic<br class="">
                        -  // stores here but it isn't clear that this
                        is important.<br class="">
                        -  if (!SI.isSimple())<br class="">
                        +  // FIXME: We could probably with some care
                        handle both volatile and ordered<br class="">
                        +  // atomic stores here but it isn't clear that
                        this is important.<br class="">
                        +  if (!SI.isUnordered())<br class="">
                            return false;<br class="">
                        <br class="">
                          Value *V = SI.getValueOperand();<br class="">
                        <br class="">
                        Modified:
                        llvm/trunk/test/Transforms/InstCombine/atomic.ll<br
                          class="">
                        URL:<span class="Apple-converted-space"> </span><a
                          moz-do-not-send="true"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/atomic.ll?rev=268809&r1=268808&r2=268809&view=diff"
                          class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/atomic.ll?rev=268809&r1=268808&r2=268809&view=diff</a><br
                          class="">
==============================================================================<br
                          class="">
                        ---
                        llvm/trunk/test/Transforms/InstCombine/atomic.ll
                        (original)<br class="">
                        +++
                        llvm/trunk/test/Transforms/InstCombine/atomic.ll
                        Fri May  6 17:17:01 2016<br class="">
                        @@ -206,3 +206,64 @@ block2:<br class="">
                        merge:<br class="">
                          ret i32 0<br class="">
                        }<br class="">
                        +<br class="">
                        +declare void @clobber()<br class="">
                        +<br class="">
                        +define i32 @test18(float* %p) {<br class="">
                        +; CHECK-LABEL: define i32 @test18(<br class="">
                        +; CHECK: load atomic i32, i32* [[A:%.*]]
                        unordered, align 4<br class="">
                        +; CHECK: store atomic i32 [[B:%.*]], i32*
                        [[C:%.*]] unordered, align 4<br class="">
                        +  %x = load atomic float, float* %p unordered,
                        align 4<br class="">
                        +  call void @clobber() ;; keep the load around<br
                          class="">
                        +  store atomic float %x, float* %p unordered,
                        align 4<br class="">
                        +  ret i32 0<br class="">
                        +}<br class="">
                        +<br class="">
                        +; TODO: probably also legal in this case<br
                          class="">
                        +define i32 @test19(float* %p) {<br class="">
                        +; CHECK-LABEL: define i32 @test19(<br class="">
                        +; CHECK: load atomic float, float* %p seq_cst,
                        align 4<br class="">
                        +; CHECK: store atomic float %x, float* %p
                        seq_cst, align 4<br class="">
                        +  %x = load atomic float, float* %p seq_cst,
                        align 4<br class="">
                        +  call void @clobber() ;; keep the load around<br
                          class="">
                        +  store atomic float %x, float* %p seq_cst,
                        align 4<br class="">
                        +  ret i32 0<br class="">
                        +}<br class="">
                        +<br class="">
                        +define i32 @test20(i32** %p, i8* %v) {<br
                          class="">
                        +; CHECK-LABEL: define i32 @test20(<br class="">
                        +; CHECK: store atomic i8* %v, i8** [[D:%.*]]
                        unordered, align 4<br class="">
                        +  %cast = bitcast i8* %v to i32*<br class="">
                        +  store atomic i32* %cast, i32** %p unordered,
                        align 4<br class="">
                        +  ret i32 0<br class="">
                        +}<br class="">
                        +<br class="">
                        +define i32 @test21(i32** %p, i8* %v) {<br
                          class="">
                        +; CHECK-LABEL: define i32 @test21(<br class="">
                        +; CHECK: store atomic i32* %cast, i32** %p
                        monotonic, align 4<br class="">
                        +  %cast = bitcast i8* %v to i32*<br class="">
                        +  store atomic i32* %cast, i32** %p monotonic,
                        align 4<br class="">
                        +  ret i32 0<br class="">
                        +}<br class="">
                        +<br class="">
                        +define void @pr27490a(i8** %p1, i8** %p2) {<br
                          class="">
                        +; CHECK-LABEL: define void @pr27490<br class="">
                        +; CHECK: %1 = bitcast i8** %p1 to i64*<br
                          class="">
                        +; CHECK: %l1 = load i64, i64* %1, align 8<br
                          class="">
                        +; CHECK: %2 = bitcast i8** %p2 to i64*<br
                          class="">
                        +; CHECK: store volatile i64 %l1, i64* %2, align
                        8<br class="">
                        +  %l = load i8*, i8** %p1<br class="">
                        +  store volatile i8* %l, i8** %p2<br class="">
                        +  ret void<br class="">
                        +}<br class="">
                        +<br class="">
                        +define void @pr27490b(i8** %p1, i8** %p2) {<br
                          class="">
                        +; CHECK-LABEL: define void @pr27490<br class="">
                        +; CHECK: %1 = bitcast i8** %p1 to i64*<br
                          class="">
                        +; CHECK: %l1 = load i64, i64* %1, align 8<br
                          class="">
                        +; CHECK: %2 = bitcast i8** %p2 to i64*<br
                          class="">
                        +; CHECK: store atomic i64 %l1, i64* %2 seq_cst,
                        align 8<br class="">
                        +  %l = load i8*, i8** %p1<br class="">
                        +  store atomic i8* %l, i8** %p2 seq_cst, align
                        8<br class="">
                        +  ret void<br class="">
                        +}<br class="">
                        <br class="">
                        <br class="">
                        _______________________________________________<br
                          class="">
                        llvm-commits mailing list<br class="">
                        <a moz-do-not-send="true"
                          href="mailto:llvm-commits@lists.llvm.org"
                          class="">llvm-commits@lists.llvm.org</a><br
                          class="">
                        <a moz-do-not-send="true"
                          href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
                          class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></blockquote>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
            </blockquote>
          </div>
          <br class="">
        </div>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>