[LLVMbugs] [Bug 22535] New: r228558 miscompiled x32

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 10 13:41:14 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22535

            Bug ID: 22535
           Summary: r228558 miscompiled x32
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: llvmbugs at cs.uiuc.edu, michael.m.kuperstein at intel.com,
                    t.p.northover at gmail.com
    Classification: Unclassified

Created attachment 13835
  --> http://llvm.org/bugs/attachment.cgi?id=13835&action=edit
A testcase

commit c4af8c94675626aac3e1ed3fa1809df753273d28
Author: Tim Northover <tnorthover at apple.com>
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: https://llvm.org/svn/llvm-project/llvm/trunk@228558
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 at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150210/e8d0b8ae/attachment.html>


More information about the llvm-bugs mailing list