[LLVMdev] code generation removes duplicated instructions
renato.golin at arm.com
Wed Jul 6 03:18:21 PDT 2011
On 6 July 2011 02:31, D S Khudia <daya.khudia at gmail.com> wrote:
> %0 = load i32* %i, align 4
> %HV14_ = getelementptr inbounds [100 x i32]* %a, i32 0, i32 %0
> %1 = getelementptr inbounds [100 x i32]* %a, i32 0, i32 %0
> %HVCmp7 = icmp ne i32* %1, %HV14_
> br i1 %HVCmp7, label %relExit, label %bb.split
> So that HV14_ is a new instruction and I am inserting a comparison to jump
> to a newly created basic block. Somehow the code generation for arm removes
> the duplicated instruction and cmp instruction in arm assembly looks as
> cmp r0, r0
This is perfectly legal, since the two registers have exactly the same
value (a[i]) and the comparison will always be the same.
I suppose the rest of the original IR (the other array load, the
stores and the increment) are in the branched basic blocks...
> This defeats the purpose of doing the duplication in the first place. Does
> anyone have any insight on this? Can anyone suggest some starting points to
> debug this?
What is the purpose of the duplication?
More information about the llvm-dev