[LLVMdev] Branch delay slots broken.

Richard Pennington rich at pennware.com
Fri Dec 17 13:43:55 PST 2010


On 12/17/2010 02:01 PM, Bruno Cardoso Lopes wrote:
> Hi Richard,
>
>> You changes work for me also. I applied something similar to the Mips CG
>> and they worked there also. Thanks again.
>
> I can't reproduce the same problem here for Mips using clang, could
> you please attach the bitcode you used?
> Thanks
>
Hi Bruno,

This was the bitcode from a simple memset function:

; ModuleID = '../../../src/c/string/memset.c'
target datalayout = 
"E-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-n32"
target triple = "mips-ellcc-unknown"

define i8* @memset(i8* %m, i32 %c, i32 %n) nounwind {
entry:
   %tobool5 = icmp eq i32 %n, 0
   br i1 %tobool5, label %while.end, label %bb.nph

bb.nph:                                           ; preds = %entry
   %conv = trunc i32 %c to i8
   br label %while.cond

while.cond:                                       ; preds = %while.cond, 
%bb.nph
   %indvar = phi i32 [ 0, %bb.nph ], [ %indvar.next, %while.cond ]
   %s.07 = getelementptr i8* %m, i32 %indvar
   store i8 %conv, i8* %s.07, align 1, !tbaa !0
   %indvar.next = add i32 %indvar, 1
   %exitcond = icmp eq i32 %indvar.next, %n
   br i1 %exitcond, label %while.end, label %while.cond

while.end:                                        ; preds = %while.cond, 
%entry
   ret i8* %m
}

As I recall, it was the bb.nph label that was lost.

-Rich



More information about the llvm-dev mailing list