Open Quuxplusone opened 12 years ago
with the attached patch I am able to produce what seems to be correct IR to me:
pes ~/whirl$ clang -ffreestanding -mrtd -emit-llvm -O2 -S -o - dim.c
; ModuleID = 'dim.c'
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"
target triple = "x86_64-unknown-freebsd8.2"
%struct.foo = type { [100 x i32] }
define x86_stdcallcc void @baz(%struct.foo* %x, %struct.foo* %y) nounwind
uwtable {
entry:
tail call x86_stdcallcc void @bar() nounwind
%0 = bitcast %struct.foo* %x to i8*
%1 = bitcast %struct.foo* %y to i8*
tail call x86_stdcallcc void @memcpy(i8* %0, i8* %1, i32 400) nounwind
tail call x86_stdcallcc void @bar() nounwind
tail call x86_stdcallcc void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 400, i32 4, i1 false)
tail call x86_stdcallcc void @bar() nounwind
ret void
}
declare x86_stdcallcc void @bar()
declare x86_stdcallcc void @memcpy(i8*, i8*, i32)
declare x86_stdcallcc void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8*
nocapture, i64, i32, i1) nounwind
but the produced assembly is wrong. What is wrong about the IR?
Attached llvm-clang-10597.patch
(2368 bytes, text/plain): patch
Attached llvm-clang-10597-take2.patch
(3545 bytes, text/plain): patch
llvm-clang-10597.patch
(2368 bytes, text/plain)llvm-clang-10597-take2.patch
(3545 bytes, text/plain)