[LLVMdev] Unrolling an arithmetic expression inside a loop
Duncan Sands
baldrick at free.fr
Tue Nov 23 06:27:27 PST 2010
Hi Juliusz,
> 2) In exec1 however it fails to recognize that the temporary variables
> are not reused anywhere and fails to simplify the arithmetic expression,
> producing:
> %scevgep = getelementptr i32* %X, i64 %indvar
> %scevgep4 = getelementptr i32* %Y, i64 %indvar
> %scevgep5 = getelementptr i32* %res, i64 %indvar
> %3 = load i32* %scevgep, align 4, !tbaa !0
> %4 = load i32* %scevgep4, align 4, !tbaa !0
> %5 = add nsw i32 %4, %3
> %6 = mul nsw i32 %5, %4
> %7 = mul nsw i32 %4, %4
> %8 = sub i32 %6, %7
> store i32 %8, i32* %scevgep5, align 4, !tbaa !0
>
> It is interesting, that I get better compilation output when inputting
> clang with worse input source (creating redundant temporary tables on
> stack).
this is now fixed in the development branch of LLVM.
Ciao,
Duncan.
More information about the llvm-dev
mailing list