summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-05-22 05:45:06 +0000
committerChris Lattner <sabre@nondot.org>2011-05-22 05:45:06 +0000
commitb6fcf4cfbc075fd20f496d992180d177f4f4d721 (patch)
tree455c80bd5ff1dee01c07354c50cbc4c52ce72102 /lib/Target/README.txt
parentbec6a19289e180ba2da2724e7a00bfc0836246e6 (diff)
downloadllvm-b6fcf4cfbc075fd20f496d992180d177f4f4d721.tar.gz
llvm-b6fcf4cfbc075fd20f496d992180d177f4f4d721.tar.bz2
llvm-b6fcf4cfbc075fd20f496d992180d177f4f4d721.tar.xz
move PR9408 here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index ffe3fa477b..0105ae4562 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -2305,4 +2305,44 @@ The two or/and's should be merged into one each.
//===---------------------------------------------------------------------===//
+Machine level code hoisting can be useful in some cases. For example, PR9408
+is about:
+
+typedef union {
+ void (*f1)(int);
+ void (*f2)(long);
+} funcs;
+
+void foo(funcs f, int which) {
+ int a = 5;
+ if (which) {
+ f.f1(a);
+ } else {
+ f.f2(a);
+ }
+}
+
+which we compile to:
+
+foo: # @foo
+# BB#0: # %entry
+ pushq %rbp
+ movq %rsp, %rbp
+ testl %esi, %esi
+ movq %rdi, %rax
+ je .LBB0_2
+# BB#1: # %if.then
+ movl $5, %edi
+ callq *%rax
+ popq %rbp
+ ret
+.LBB0_2: # %if.else
+ movl $5, %edi
+ callq *%rax
+ popq %rbp
+ ret
+
+Note that bb1 and bb2 are the same. This doesn't happen at the IR level
+because one call is passing an i32 and the other is passing an i64.
+//===---------------------------------------------------------------------===//