diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-15 07:25:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-15 07:25:55 +0000 |
commit | 08859ffa6312f3bf7bd08fc98a81a6c86e1c9752 (patch) | |
tree | f416a683fff1146db0d8a38f2ebd501e47e99b45 /lib/Target/README.txt | |
parent | b35d56c2fe39064a33d0e4e7faf5464b6d8a7352 (diff) | |
download | external_llvm-08859ffa6312f3bf7bd08fc98a81a6c86e1c9752.zip external_llvm-08859ffa6312f3bf7bd08fc98a81a6c86e1c9752.tar.gz external_llvm-08859ffa6312f3bf7bd08fc98a81a6c86e1c9752.tar.bz2 |
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.txt | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 17617ad..e59c286 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 //===---------------------------------------------------------------------===// |