diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-06-27 06:04:18 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-06-27 06:04:18 +0000 | 
| commit | 895c52ba8ba8e3a70882c83c0dee6c035a7551c5 (patch) | |
| tree | 5d5cf6671018b673c0036de76469ea892bab8ff1 /clang/lib/CodeGen/CodeGenFunction.cpp | |
| parent | 1cd6698a7c2b0f9454880ba26888cc3ac0d274bb (diff) | |
| download | llvm-895c52ba8ba8e3a70882c83c0dee6c035a7551c5.zip llvm-895c52ba8ba8e3a70882c83c0dee6c035a7551c5.tar.gz llvm-895c52ba8ba8e3a70882c83c0dee6c035a7551c5.tar.bz2  | |
Same patch as the previous on the store side.  Before we compiled this:
struct DeclGroup {
  unsigned NumDecls;
};
int foo(DeclGroup D) {
  return D.NumDecls;
}
to:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %tmp = alloca i64                               ; <i64*> [#uses=2]
  store i64 %0, i64* %tmp
  %1 = bitcast i64* %tmp to %struct.DeclGroup*    ; <%struct.DeclGroup*> [#uses=1]
  %2 = load %struct.DeclGroup* %1, align 1        ; <%struct.DeclGroup> [#uses=1]
  store %struct.DeclGroup %2, %struct.DeclGroup* %D
  %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp2 = load i32* %tmp1                         ; <i32> [#uses=1]
  ret i32 %tmp2
}
which caused fast isel bailouts due to the FCA load/store of %2.  Now
we generate this just blissful code:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
  %D = alloca %struct.DeclGroup, align 4          ; <%struct.DeclGroup*> [#uses=2]
  %tmp = alloca i64                               ; <i64*> [#uses=2]
  %coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  store i64 %0, i64* %tmp
  %1 = bitcast i64* %tmp to i32*                  ; <i32*> [#uses=1]
  %2 = load i32* %1, align 1                      ; <i32> [#uses=1]
  store i32 %2, i32* %coerce.dive
  %tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
  %tmp2 = load i32* %tmp1                         ; <i32> [#uses=1]
  ret i32 %tmp2
}
This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.
llvm-svn: 106974
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions
