[LLVMbugs] [Bug 11238] New: suboptimal code generation in pointer comparison (this also affects std::vector.push_back())

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 26 11:18:05 PDT 2011


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

           Summary: suboptimal code generation in pointer comparison (this
                    also affects std::vector.push_back())
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: s3734770 at mail.zih.tu-dresden.de
                CC: llvmbugs at cs.uiuc.edu


Test Case:

; ModuleID = 'x.ll'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"

%t = type { i32, i32 }

define i32 @main() nounwind readnone {
r1:
  %x = alloca %t, align 8
  %a = getelementptr %t* %x, i64 0, i32 0
  %b = getelementptr %t* %x, i64 0, i32 1
  %equal = icmp eq i32* %a, %b
  %merge = select i1 %equal, i32 1, i32 2
  ret i32 %merge
}

I think the issue should be obviously.
Have fun fixing it. This code occurs also on code generation of the C++
template std::vector:

#include <vector>
#include <iostream>

using namespace std;

int main() {
  vector<int> v;
  v.push_back(1);
  v.push_back(2);
  v.push_back(3);
  for(vector<int>::iterator it = v.begin(); it < v.end(); it++) {
    cout << *it << endl;
  }
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list