<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Well, given your view as the bot owner, I'm going to just leave
      things as is.  I don't like the notion of leaving a bot red, but I
      don't see any way for me to help figuring out what's going on
      here.  Let me know if anything leads you to believe this is a
      problem with the change after all.</p>
    <p>Philip<br>
    </p>
    <div class="moz-cite-prefix">On 3/23/22 10:09, Reid Kleckner wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACs=ty+JzMiy=t+HLQchZYpjkxJNGAMjRnqGOpMgEwxXs3-1ZA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div><br>
        </div>
        My guess is that this failure is unrelated to your change. I
        blame the MSVC linker, which is producing these errors. I forced
        a clean build, but it looks like it didn't do anything.
        <div><br>
        </div>
        <div>I think we should move to using lld-link across the Windows
          ASan test suite. It doesn't try to do incremental linking, so
          it won't have sticky file format corruption errors like this.
          This removes some degree of integration testing, so we might
          want to bring back some explicit integration testing.</div>
        <div><br>
        </div>
        <div>Also, IIRC Matthew left Microsoft some time ago, or changed
          teams there.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Mar 23, 2022 at 7:30
          AM Philip Reames <<a
            href="mailto:listmail@philipreames.com"
            moz-do-not-send="true" class="moz-txt-link-freetext">listmail@philipreames.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Reid,
          Matthew,<br>
          <br>
          You two are the bot owner and the last person to touch this
          test <br>
          respectively.  Any chance I could ask for some help here?<br>
          <br>
          I'm fairly sure the bot failure mentioned below is a real
          failure, but <br>
          a) no other bot has failed, and b) I can't translate how
          removing a <br>
          memcpy could lead to "LINK : fatal error LNK1318: Unexpected
          PDB error; <br>
          FORMAT (11) ''".  Any idea what might be going on with this
          test?  Or <br>
          ideas on how to reproduce it which don't require a windows
          build?<br>
          <br>
          I *suspect* this is a case where the test needs adjusted to
          prevent <br>
          something being optimized away - that's the typical asan test
          pattern <br>
          for new memcpy opts - but I might be wrong about that.<br>
          <br>
          Philip<br>
          <br>
          On 3/22/22 14:46, Philip Reames via llvm-commits wrote:<br>
          > I've got one buildbot which might be failing on this: <br>
          > <a
            href="https://lab.llvm.org/buildbot#builders/127/builds/26790"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lab.llvm.org/buildbot#builders/127/builds/26790</a><br>
          ><br>
          > However, I can't make heads or tails out the failure
          message and the <br>
          > test isn't obvious unstable.  Waiting to see if any Linux
          bots fail <br>
          > with something I can understand.<br>
          ><br>
          > Philip<br>
          ><br>
          > On 3/22/22 13:49, Philip Reames via llvm-commits wrote:<br>
          >> Author: Philip Reames<br>
          >> Date: 2022-03-22T13:48:48-07:00<br>
          >> New Revision:
          7abefc42220b74551b433083ece33be31e48700f<br>
          >><br>
          >> URL: <br>
          >> <a
href="https://github.com/llvm/llvm-project/commit/7abefc42220b74551b433083ece33be31e48700f"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://github.com/llvm/llvm-project/commit/7abefc42220b74551b433083ece33be31e48700f</a><br>
          >> DIFF: <br>
          >> <a
href="https://github.com/llvm/llvm-project/commit/7abefc42220b74551b433083ece33be31e48700f.diff"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://github.com/llvm/llvm-project/commit/7abefc42220b74551b433083ece33be31e48700f.diff</a><br>
          >><br>
          >> LOG: [instcombine] Fold away memset/memmove from
          otherwise unused alloca<br>
          >><br>
          >> The motivation for this is that while both memcpyopt
          and dse will <br>
          >> catch this case, both are limited by MSSA's walk back
          threshold when <br>
          >> finding clobbers.  As such, if you have a memcpy of
          an otherwise dead <br>
          >> alloca placed towards the end of a long basic block
          with lots of <br>
          >> other memory instructions, it would be missed.  This
          is a bit <br>
          >> undesirable for such an "obviously" useless bit of
          code.<br>
          >><br>
          >> As noted in comments, we should probably generalize
          instcombine's <br>
          >> escape analysis peephole (see visitAllocInst) to
          allow read xor <br>
          >> write.  Doing that would subsume this code in a more
          general way, but <br>
          >> is also a more involved change.  For the moment, I
          went with the <br>
          >> easiest fix.<br>
          >><br>
          >> Added:<br>
          >><br>
          >> Modified:<br>
          >>     
          llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
          >>      llvm/test/Transforms/Inline/byval-tail-call.ll<br>
          >>     
          llvm/test/Transforms/InstCombine/memcpy_alloca.ll<br>
          >><br>
          >> Removed:<br>
          >><br>
          >><br>
          >>
################################################################################
          <br>
          >><br>
          >> diff  --git
          a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp <br>
          >>
          b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
          >> index 9327dda3924dc..b3edec04fbcef 100644<br>
          >> ---
          a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
          >> +++
          b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
          >> @@ -104,6 +104,19 @@ static Type
          *getPromotedType(Type *Ty) {<br>
          >>     return Ty;<br>
          >>   }<br>
          >>   +/// Recognize a memcpy/memmove from a trivially
          otherwise unused <br>
          >> alloca.<br>
          >> +/// TODO: This should probably be integrated with
          visitAllocSites, <br>
          >> but that<br>
          >> +/// requires a deeper change to allow either unread
          or unwritten <br>
          >> objects.<br>
          >> +static bool hasUndefSource(AnyMemTransferInst *MI) {<br>
          >> +  auto *Src = MI->getRawSource();<br>
          >> +  while (isa<GetElementPtrInst>(Src) ||
          isa<BitCastInst>(Src)) {<br>
          >> +    if (!Src->hasOneUse())<br>
          >> +      return false;<br>
          >> +    Src =
          cast<Instruction>(Src)->getOperand(0);<br>
          >> +  }<br>
          >> +  return isa<AllocaInst>(Src) &&
          Src->hasOneUse();<br>
          >> +}<br>
          >> +<br>
          >>   Instruction <br>
          >>
          *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst
          *MI) {<br>
          >>     Align DstAlign =
          getKnownAlignment(MI->getRawDest(), DL, MI, &AC, <br>
          >> &DT);<br>
          >>     MaybeAlign CopyDstAlign = MI->getDestAlign();<br>
          >> @@ -128,6 +141,14 @@ Instruction <br>
          >>
          *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst
          *MI) {<br>
          >>       return MI;<br>
          >>     }<br>
          >>   +  // If the source is provably undef, the
          memcpy/memmove doesn't <br>
          >> do anything<br>
          >> +  // (unless the transfer is volatile).<br>
          >> +  if (hasUndefSource(MI) &&
          !MI->isVolatile()) {<br>
          >> +    // Set the size of the copy to 0, it will be
          deleted on the next <br>
          >> iteration.<br>
          >> +
MI->setLength(Constant::getNullValue(MI->getLength()->getType()));<br>
          >> +    return MI;<br>
          >> +  }<br>
          >> +<br>
          >>     // If MemCpyInst length is 1/2/4/8 bytes then
          replace memcpy with<br>
          >>     // load/store.<br>
          >>     ConstantInt *MemOpLength =
          dyn_cast<ConstantInt>(MI->getLength());<br>
          >><br>
          >> diff  --git
          a/llvm/test/Transforms/Inline/byval-tail-call.ll <br>
          >> b/llvm/test/Transforms/Inline/byval-tail-call.ll<br>
          >> index a820bcb427dcf..19be5e5827f04 100644<br>
          >> --- a/llvm/test/Transforms/Inline/byval-tail-call.ll<br>
          >> +++ b/llvm/test/Transforms/Inline/byval-tail-call.ll<br>
          >> @@ -92,14 +92,11 @@ define void @foobar(i32* %x) {<br>
          >>   define void @barfoo() {<br>
          >>   ; CHECK-LABEL: @barfoo(<br>
          >>   ; CHECK-NEXT:    [[X1:%.*]] = alloca i32, align 4<br>
          >> -; CHECK-NEXT:    [[X:%.*]] = alloca i32, align 4<br>
          >>   ; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i32* [[X1]]
          to i8*<br>
          >>   ; CHECK-NEXT:    call void
          @llvm.lifetime.start.p0i8(i64 4, i8* <br>
          >> nonnull [[TMP1]])<br>
          >> -; CHECK-NEXT:    [[TMP2:%.*]] = load i32, i32*
          [[X]], align 4<br>
          >> -; CHECK-NEXT:    store i32 [[TMP2]], i32* [[X1]],
          align 4<br>
          >>   ; CHECK-NEXT:    tail call void @ext2(i32* nonnull
          byval(i32) [[X1]])<br>
          >> -; CHECK-NEXT:    [[TMP3:%.*]] = bitcast i32* [[X1]]
          to i8*<br>
          >> -; CHECK-NEXT:    call void
          @llvm.lifetime.end.p0i8(i64 4, i8* <br>
          >> nonnull [[TMP3]])<br>
          >> +; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i32* [[X1]]
          to i8*<br>
          >> +; CHECK-NEXT:    call void
          @llvm.lifetime.end.p0i8(i64 4, i8* <br>
          >> nonnull [[TMP2]])<br>
          >>   ; CHECK-NEXT:    ret void<br>
          >>   ;<br>
          >>     %x = alloca i32<br>
          >><br>
          >> diff  --git
          a/llvm/test/Transforms/InstCombine/memcpy_alloca.ll <br>
          >> b/llvm/test/Transforms/InstCombine/memcpy_alloca.ll<br>
          >> index b7288d9f07476..fabf920c6e68d 100644<br>
          >> ---
          a/llvm/test/Transforms/InstCombine/memcpy_alloca.ll<br>
          >> +++
          b/llvm/test/Transforms/InstCombine/memcpy_alloca.ll<br>
          >> @@ -4,9 +4,6 @@<br>
          >>   ; Memcpy is copying known-undef, and is thus
          removable<br>
          >>   define void @test(i8* %dest) {<br>
          >>   ; CHECK-LABEL: @test(<br>
          >> -; CHECK-NEXT:    [[A:%.*]] = alloca [7 x i8], align
          1<br>
          >> -; CHECK-NEXT:    [[SRC:%.*]] = getelementptr
          inbounds [7 x i8], [7 x <br>
          >> i8]* [[A]], i64 0, i64 0<br>
          >> -; CHECK-NEXT:    call void
          @llvm.memcpy.p0i8.p0i8.i64(i8* noundef <br>
          >> nonnull align 1 dereferenceable(7) [[DEST:%.*]], i8*
          noundef nonnull <br>
          >> align 1 dereferenceable(7) [[SRC]], i64 7, i1 false)<br>
          >>   ; CHECK-NEXT:    ret void<br>
          >>   ;<br>
          >>     %a = alloca [7 x i8]<br>
          >> @@ -47,9 +44,6 @@ define void @test3(i8* %dest) {<br>
          >>     define void @test4(i8* %dest) {<br>
          >>   ; CHECK-LABEL: @test4(<br>
          >> -; CHECK-NEXT:    [[A1:%.*]] = alloca [7 x i8], align
          1<br>
          >> -; CHECK-NEXT:    [[A1_SUB:%.*]] = getelementptr
          inbounds [7 x i8], <br>
          >> [7 x i8]* [[A1]], i64 0, i64 0<br>
          >> -; CHECK-NEXT:    call void
          @llvm.memcpy.p0i8.p0i8.i64(i8* noundef <br>
          >> nonnull align 1 dereferenceable(7) [[DEST:%.*]], i8*
          noundef nonnull <br>
          >> align 1 dereferenceable(7) [[A1_SUB]], i64 7, i1
          false)<br>
          >>   ; CHECK-NEXT:    ret void<br>
          >>   ;<br>
          >>     %a = alloca [7 x i8]<br>
          >> @@ -60,9 +54,6 @@ define void @test4(i8* %dest) {<br>
          >>     define void @test5(i8* %dest) {<br>
          >>   ; CHECK-LABEL: @test5(<br>
          >> -; CHECK-NEXT:    [[A:%.*]] = alloca [7 x i8], align
          1<br>
          >> -; CHECK-NEXT:    [[P2:%.*]] = getelementptr inbounds
          [7 x i8], [7 x <br>
          >> i8]* [[A]], i64 0, i64 4<br>
          >> -; CHECK-NEXT:    call void
          @llvm.memcpy.p0i8.p0i8.i64(i8* noundef <br>
          >> nonnull align 1 dereferenceable(3) [[DEST:%.*]], i8*
          noundef nonnull <br>
          >> align 1 dereferenceable(3) [[P2]], i64 3, i1 false)<br>
          >>   ; CHECK-NEXT:    ret void<br>
          >>   ;<br>
          >>     %a = alloca [7 x i8]<br>
          >><br>
          >><br>
          >>         
          _______________________________________________<br>
          >> llvm-commits mailing list<br>
          >> <a href="mailto:llvm-commits@lists.llvm.org"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">llvm-commits@lists.llvm.org</a><br>
          >> <a
            href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
          > _______________________________________________<br>
          > llvm-commits mailing list<br>
          > <a href="mailto:llvm-commits@lists.llvm.org"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">llvm-commits@lists.llvm.org</a><br>
          > <a
            href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>