summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-15 07:25:55 +0000
committerChris Lattner <sabre@nondot.org>2010-12-15 07:25:55 +0000
commit08859ffa6312f3bf7bd08fc98a81a6c86e1c9752 (patch)
treef416a683fff1146db0d8a38f2ebd501e47e99b45 /lib/Target/README.txt
parentb35d56c2fe39064a33d0e4e7faf5464b6d8a7352 (diff)
add a note about overflow idiom recognition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 17617ad5473..e59c28697a1 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -73,7 +73,25 @@ This has a number of uses:
//===---------------------------------------------------------------------===//
-Make the PPC branch selector target independant
+We should recognized various "overflow detection" idioms and translate them into
+llvm.uadd.with.overflow and similar intrinsics. For example, we compile this:
+
+size_t add(size_t a,size_t b) {
+ if (a+b<a)
+ exit(0);
+ return a+b;
+}
+
+into:
+
+ addq %rdi, %rbx
+ cmpq %rdi, %rbx
+ jae LBB0_2
+
+when it would be better to generate:
+
+ addq %rdi, %rbx
+ jno LBB0_2
//===---------------------------------------------------------------------===//