<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - r228558 miscompiled x32"
   href="http://llvm.org/bugs/show_bug.cgi?id=22535">22535</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>r228558 miscompiled x32
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hjl.tools@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, michael.m.kuperstein@intel.com, t.p.northover@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13835" name="attach_13835" title="A testcase">attachment 13835</a> <a href="attachment.cgi?id=13835&action=edit" title="A testcase">[details]</a></span>
A testcase

commit c4af8c94675626aac3e1ed3fa1809df753273d28
Author: Tim Northover <<a href="mailto:tnorthover@apple.com">tnorthover@apple.com</a>>
Date:   Mon Feb 9 01:20:53 2015 +0000

    DeadArgElim: assess uses of entire return value aggregate.

    Previously, a non-extractvalue use of an aggregate return value meant
    the entire return was considered live (the algorithm gave up
    entirely). This was correct, but conservative. It's better to actually
    look at that Use, making the analysis results apply to all sub-values
    under consideration.

    E.g.

      %val = call { i32, i32 } @whatever()
      [...]
      ret { i32, i32 } %val

    The return is using the entire aggregate (sub-values 0 and 1). We can
    still simplify @whatever if we can prove that this return is itself
    unused.

    Also unifies the logic slightly between aggregate and non-aggregate
    cases..

    git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@228558">https://llvm.org/svn/llvm-project/llvm/trunk@228558</a>
91177308-0d34-0410-b5e6-96231b3b80d8

miscompiled the testcase included here:

/export/build/gnu/llvm-clang/build-x86_64-linux/Debug+Asserts/bin/opt
-deadargelim -O1 -S foo.ll -o good.ll
/export/build/gnu/llvm-clang/release/opt/llvm/master/bin/x86_64-linux-opt
-deadargelim -O1 -S foo.ll -o bad.ll
diff -up good.ll bad.ll
--- good.ll    2015-02-10 13:39:48.478799341 -0800
+++ bad.ll    2015-02-10 13:39:48.518798603 -0800
@@ -203,7 +203,7 @@ declare dereferenceable(8) %"class.llvm:

 declare dereferenceable(1) i8*
@_ZSt7forwardIRbEOT_RNSt16remove_referenceIS1_E4typeE(i8* dereferenceable(1))

-define internal fastcc i8
@_ZN4llvm15SmallPtrSetImplIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEE6insertES9_(%"class.llvm::SmallPtrSetImpl.315"*
%this, %"struct.llvm::detail::DenseMapPair.263"* %Ptr) align 2 {
+define internal fastcc void
@_ZN4llvm15SmallPtrSetImplIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEE6insertES9_(%"class.llvm::SmallPtrSetImpl.315"*
%this, %"struct.llvm::detail::DenseMapPair.263"* %Ptr) align 2 {
 entry:
   %p = alloca i64, align 8
   %tmpcast = bitcast i64* %p to %"struct.std::pair.289"*
@@ -221,27 +221,23 @@ entry:
   %add.ptr = getelementptr inbounds i8** %2, i32 %3
   call void
@_ZN4llvm19SmallPtrSetIteratorIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEC2EPKPKvSE_(%"class.llvm::SmallPtrSetIterator.323"*
%ref.tmp, i8** %1, i8** %add.ptr)
   %second = getelementptr inbounds %"struct.std::pair.289"* %tmpcast, i32 0,
i32 1
-  %call3 = call fastcc i8
@_ZSt9make_pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEERbESt4pairINSt17__decay_and_stripIT_E6__typeENSE_IT0_E6__typeEEOSF_OSI_(%"class.llvm::SmallPtrSetIterator.323"*
dereferenceable(8) %ref.tmp, i8* dereferenceable(1) %second)
-  ret i8 %call3
+  call fastcc void
@_ZSt9make_pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEERbESt4pairINSt17__decay_and_stripIT_E6__typeENSE_IT0_E6__typeEEOSF_OSI_(%"class.llvm::SmallPtrSetIterator.323"*
dereferenceable(8) %ref.tmp, i8* dereferenceable(1) %second)
+  ret void
 }

-define internal fastcc i8
@_ZSt9make_pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEERbESt4pairINSt17__decay_and_stripIT_E6__typeENSE_IT0_E6__typeEEOSF_OSI_(%"class.llvm::SmallPtrSetIterator.323"*
dereferenceable(8) %__x, i8* dereferenceable(1) %__y) {
+define internal fastcc void
@_ZSt9make_pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEERbESt4pairINSt17__decay_and_stripIT_E6__typeENSE_IT0_E6__typeEEOSF_OSI_(%"class.llvm::SmallPtrSetIterator.323"*
dereferenceable(8) %__x, i8* dereferenceable(1) %__y) {
 entry:
   %retval = alloca %"struct.std::pair.322", align 8
   %call = tail call dereferenceable(8) %"class.llvm::SmallPtrSetIterator.323"*
@_ZSt7forwardIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEEEOT_RNSt16remove_referenceISC_E4typeE(%"class.llvm::SmallPtrSetIterator.323"*
dereferenceable(8) %__x)
   %call1 = tail call dereferenceable(1) i8*
@_ZSt7forwardIRbEOT_RNSt16remove_referenceIS1_E4typeE(i8* dereferenceable(1)
%__y)
   call void
@_ZNSt4pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEEbEC2ISB_RbvEEOT_OT0_(%"struct.std::pair.322"*
%retval, %"class.llvm::SmallPtrSetIterator.323"* dereferenceable(8) %call, i8*
dereferenceable(1) %call1)
-  %tmp.sroa.2.0..sroa_idx = getelementptr inbounds %"struct.std::pair.322"*
%retval, i32 0, i32 1
-  %tmp.sroa.2.0.copyload = load i8* %tmp.sroa.2.0..sroa_idx, align 8
-  ret i8 %tmp.sroa.2.0.copyload
+  ret void
 }

 define zeroext i1
@_ZN4llvm9SetVectorIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEENS_11SmallVectorIS9_Lj8EEENS_8SmallSetIS9_Lj8ESt4lessIS9_EEEE6insertERKS9_(%"class.llvm::SetVector"*
%this, %"struct.llvm::detail::DenseMapPair.263"** nocapture readonly
dereferenceable(4) %X) align 2 {
 entry:
   %0 = getelementptr inbounds %"class.llvm::SetVector"* %this, i32 0, i32 0,
i32 0, i32 0
   %1 = load %"struct.llvm::detail::DenseMapPair.263"** %X, align 4
-  %call = tail call fastcc i8
@_ZN4llvm15SmallPtrSetImplIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEE6insertES9_(%"class.llvm::SmallPtrSetImpl.315"*
%0, %"struct.llvm::detail::DenseMapPair.263"* %1)
-  %2 = and i8 %call, 1
-  %tobool = icmp ne i8 %2, 0
-  ret i1 %tobool
+  tail call fastcc void
@_ZN4llvm15SmallPtrSetImplIPNS_6detail12DenseMapPairIPNS_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEE6insertES9_(%"class.llvm::SmallPtrSetImpl.315"*
%0, %"struct.llvm::detail::DenseMapPair.263"* %1)
+  ret i1 false
 }
make: *** [all] Error 1
[hjl@gnu-mic-2 dead]$ 

@_ZSt9make_pairIN4llvm19SmallPtrSetIteratorIPNS0_6detail12DenseMapPairIPNS0_6VNInfoEN12_GLOBAL__N_113InlineSpiller12SibValueInfoEEEEERbESt4pairINSt17__decay_and_stripIT_E6__typeENSE_IT0_E6__typeEEOSF_OSI_

shouldn't become return void.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>