Skip to content
  • Chris Lattner's avatar
    Improve codegen for the LLVM offsetof/sizeof "operator". Before we compiled · 33930ad7
    Chris Lattner authored
    this LLVM function:
    
    int %foo() {
            ret int cast (int** getelementptr (int** null, int 1) to int)
    }
    
    into:
    
    foo:
            mov %EAX, 0
            lea %EAX, DWORD PTR [%EAX + 4]
            ret
    
    now we compile it into:
    
    foo:
            mov %EAX, 4
            ret
    
    This sequence is frequently generated by the MSIL front-end, and soon the malloc lowering pass and
    Java front-ends as well..
    
    -Chris
    
    llvm-svn: 14834
    33930ad7
Loading