summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-01-06 15:37:47 +0000
committerDuncan Sands <baldrick@free.fr>2010-01-06 15:37:47 +0000
commitc8493da5b18fec8995ba90a0e609cf4bd9003554 (patch)
tree5d1beb08643f9e7f16e86fac6e73f1602fb5cc7d /llvm/lib/Target
parentfd0b2f8fe486f707b4f7b71501c1b60e5e7b5fd2 (diff)
downloadbcm5719-llvm-c8493da5b18fec8995ba90a0e609cf4bd9003554.tar.gz
bcm5719-llvm-c8493da5b18fec8995ba90a0e609cf4bd9003554.zip
Fix a README item: have functionattrs look through selects and
phi nodes when deciding which pointers point to local memory. I actually checked long ago how useful this is, and it isn't very: it hardly ever fires in the testsuite, but since Chris wants it here it is! llvm-svn: 92836
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/README.txt31
1 files changed, 1 insertions, 30 deletions
diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt
index 38c3daa9383..69da35f1c7a 100644
--- a/llvm/lib/Target/README.txt
+++ b/llvm/lib/Target/README.txt
@@ -1648,36 +1648,7 @@ would delete the or instruction for us.
//===---------------------------------------------------------------------===//
-FunctionAttrs is not marking this function as readnone (just readonly):
-$ clang t.c -emit-llvm -S -o - -O0 | opt -mem2reg -S -functionattrs
-
-int t(int a, int b, int c) {
- int *p;
- if (a)
- p = &a;
- else
- p = &c;
- return *p;
-}
-
-This is because we codegen this to:
-
-define i32 @t(i32 %a, i32 %b, i32 %c) nounwind readonly ssp {
-entry:
- %a.addr = alloca i32 ; <i32*> [#uses=3]
- %c.addr = alloca i32 ; <i32*> [#uses=2]
-...
-
-if.end:
- %p.0 = phi i32* [ %a.addr, %if.then ], [ %c.addr, %if.else ]
- %tmp2 = load i32* %p.0 ; <i32> [#uses=1]
- ret i32 %tmp2
-}
-
-And functionattrs doesn't realize that the p.0 load points to function local
-memory.
-
-Also, functionattrs doesn't know about memcpy/memset. This function should be
+functionattrs doesn't know much about memcpy/memset. This function should be
marked readnone rather than readonly, since it only twiddles local memory, but
functionattrs doesn't handle memset/memcpy/memmove aggressively:
OpenPOWER on IntegriCloud