llvm-project/llvm
Chris Lattner 98457101fc Enhance the "compare with shift" and "compare with div"
optimizations to be much more aggressive in the face of
exact/nsw/nuw div and shifts.  For example, these (which
are the same except the first is 'exact' sdiv:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %A = sdiv exact i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %A = sdiv i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

compile down to:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %1 = icmp eq i64 %X, 0
  ret i1 %1
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %X.off = add i64 %X, 4
  %1 = icmp ult i64 %X.off, 9
  ret i1 %1
}

This happens when you do something like:
  (ptr1-ptr2) == 42

where the pointers are pointers to non-unit types.

llvm-svn: 125266
2011-02-10 05:23:05 +00:00
..
autoconf lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*. 2011-02-09 04:18:48 +00:00
bindings Fix compiling the ocaml kaleidoscope tutorials 2011-02-09 18:32:02 +00:00
cmake CMake: Add the new option LLVM_LIT_TOOLS_DIR. It can specify "Path to GnuWin32 tools". 2011-02-09 04:18:58 +00:00
docs Don't run ocamldoc if it's not installed 2011-02-09 18:32:04 +00:00
examples Fix compiling the ocaml kaleidoscope tutorials 2011-02-09 18:32:02 +00:00
include Rip out realpath() support. It's expensive, and often a bad idea, and 2011-02-09 23:33:15 +00:00
lib Enhance the "compare with shift" and "compare with div" 2011-02-10 05:23:05 +00:00
projects Regen configure 2010-12-12 21:42:01 +00:00
runtime Implementation of path profiling. 2011-01-29 01:09:53 +00:00
test Enhance the "compare with shift" and "compare with div" 2011-02-10 05:23:05 +00:00
tools tools/llvm-ld/CMakeLists.txt: llvm-ld depends on llvm-stub at runtime. 2011-02-09 04:17:47 +00:00
unittests build: Add MAKEFILE_UNITTEST_NO_INCLUDE_COMMON build variable, to be leveraged 2011-02-04 17:12:18 +00:00
utils Don't return before calling the post-processing function(s). 2011-02-10 01:28:26 +00:00
website
.gitignore Cleanup and document .gitignore. 2010-12-17 17:22:50 +00:00
CMakeLists.txt Moved more stuff to HandleLLVMOptions.cmake 2011-02-05 19:08:42 +00:00
CREDITS.TXT Another git svn dcommit test. This time let's hope it doesn't kill my repo. 2010-12-10 14:45:10 +00:00
LICENSE.TXT
Makefile Merge System into Support. 2010-11-29 18:16:10 +00:00
Makefile.common
Makefile.config.in autoconf: Add --disable-embed-stdcxx to suppress linking libstdc++.a into llvm.dll with --enable-shared on Cygming. 2010-12-29 03:59:14 +00:00
Makefile.rules Factor the computation of the basename of libraries. This avoids renaming 2011-02-03 22:01:15 +00:00
ModuleInfo.txt Remove trailing space. This is just an excuse to poke the 2010-10-05 20:32:15 +00:00
README.txt Undoing test commit blank space. 2010-09-29 17:39:29 +00:00
build-for-llvm-top.sh
configure lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*. 2011-02-09 04:18:48 +00:00
llvm.spec.in

README.txt

\Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.

If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.