A new entry.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 16 Mar 2006 22:44:22 +0000 (22:44 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 16 Mar 2006 22:44:22 +0000 (22:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26810 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/README.txt

index 651d47290229924d4c0064229e5eb448ab5870eb..595409ff8bf0d3dcbba8b6ba3848fd63e918cae9 100644 (file)
@@ -584,3 +584,48 @@ Optimize copysign(x, *y) to use an integer load from y.
 
 //===---------------------------------------------------------------------===//
 
+%X = weak global int 0
+
+void %foo(int %N) {
+       %N = cast int %N to uint
+       %tmp.24 = setgt int %N, 0
+       br bool %tmp.24, label %no_exit, label %return
+
+no_exit:
+       %indvar = phi uint [ 0, %entry ], [ %indvar.next, %no_exit ]
+       %i.0.0 = cast uint %indvar to int
+       volatile store int %i.0.0, int* %X
+       %indvar.next = add uint %indvar, 1
+       %exitcond = seteq uint %indvar.next, %N
+       br bool %exitcond, label %return, label %no_exit
+
+return:
+       ret void
+}
+
+compiles into:
+
+       .text
+       .align  4
+       .globl  _foo
+_foo:
+       movl 4(%esp), %eax
+       cmpl $1, %eax
+       jl LBB_foo_4    # return
+LBB_foo_1:     # no_exit.preheader
+       xorl %ecx, %ecx
+LBB_foo_2:     # no_exit
+       movl L_X$non_lazy_ptr, %edx
+       movl %ecx, (%edx)
+       incl %ecx
+       cmpl %eax, %ecx
+       jne LBB_foo_2   # no_exit
+LBB_foo_3:     # return.loopexit
+LBB_foo_4:     # return
+       ret
+
+We should hoist "movl L_X$non_lazy_ptr, %edx" out of the loop after
+remateralization is implemented. This can be accomplished with 1) a target
+dependent LICM pass or 2) makeing SelectDAG represent the whole function. 
+
+//===---------------------------------------------------------------------===//