llvm-project/clang/lib
Chris Lattner 7f4b81af7a fix rdar://8251384, another case where we could access beyond the
end of a struct.  This improves the case when the struct being passed
contains 3 floats, either due to a struct or array of 3 things.  Before
we'd generate this IR for the testcase:

define float @bar(double %X.coerce0, double %X.coerce1) nounwind {
entry:
  %X = alloca %struct.foof, align 8               ; <%struct.foof*> [#uses=2]
  %0 = bitcast %struct.foof* %X to %1*            ; <%1*> [#uses=2]
  %1 = getelementptr %1* %0, i32 0, i32 0         ; <double*> [#uses=1]
  store double %X.coerce0, double* %1
  %2 = getelementptr %1* %0, i32 0, i32 1         ; <double*> [#uses=1]
  store double %X.coerce1, double* %2
  %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
  %tmp1 = load float* %tmp                        ; <float> [#uses=1]
  ret float %tmp1
}

which compiled (with optimization) to:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movd	%xmm1, %rax
	movd	%eax, %xmm0
	ret

Now we produce:

define float @bar(double %X.coerce0, float %X.coerce1) nounwind {
entry:
  %X = alloca %struct.foof, align 8               ; <%struct.foof*> [#uses=2]
  %0 = bitcast %struct.foof* %X to %0*            ; <%0*> [#uses=2]
  %1 = getelementptr %0* %0, i32 0, i32 0         ; <double*> [#uses=1]
  store double %X.coerce0, double* %1
  %2 = getelementptr %0* %0, i32 0, i32 1         ; <float*> [#uses=1]
  store float %X.coerce1, float* %2
  %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
  %tmp1 = load float* %tmp                        ; <float> [#uses=1]
  ret float %tmp1
}

and:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movaps	%xmm1, %xmm0
	ret

llvm-svn: 109776
2010-07-29 18:13:09 +00:00
..
AST Implement RedeclarableTemplateDecl::getNextRedeclaration 2010-07-29 16:12:09 +00:00
Analysis Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format" 2010-07-27 04:46:02 +00:00
Basic Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files. 2010-07-28 21:07:02 +00:00
Checker Use a LazyCompoundVal to handle initialization with a string literal, rather than copying each character. 2010-07-29 06:40:33 +00:00
CodeGen fix rdar://8251384, another case where we could access beyond the 2010-07-29 18:13:09 +00:00
Driver Driver/Darwin: Set -force_cpusubtype_ALL only by default on x86. 2010-07-22 01:47:22 +00:00
Frontend Store latest redeclaration for each redeclarable template declaration 2010-07-29 16:12:01 +00:00
Headers Add alternate names for x86 SIMD intrinsics. These aren't as common, but show 2010-07-22 06:47:28 +00:00
Index Remove unused location-to-AST-node resolver. libclang's implementation supercedes it 2010-07-19 16:18:30 +00:00
Lex Transcribe clattner email to SVN. 2010-07-29 02:46:02 +00:00
Parse Reword the empty struct/union warning in C to note that such structs and unions have size 0 in C, size 1 in C++. Put this warning under -Wc++-compat. 2010-07-29 14:29:34 +00:00
Rewrite Initialize block's imported variable(s) in 2010-07-28 23:27:30 +00:00
Sema Tigthen the condition for issung ivar shadowing 2010-07-29 16:53:53 +00:00
CMakeLists.txt Split libAnalysis into two libraries: libAnalysis and libChecker. 2010-01-25 04:41:41 +00:00
Makefile Move lib/Runtime to runtime/, and build after everything else. 2010-06-30 22:10:38 +00:00