InstCombine: Turn umul_with_overflow into mul nuw if we can prove that it cannot...
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 10 Mar 2011 18:40:14 +0000 (18:40 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 10 Mar 2011 18:40:14 +0000 (18:40 +0000)
commit6b96fe7e146f7eb594e67210c6bef511ad0a2058
treee45377cac2b691fd66dff4e8cb4f59c7f2193ba5
parentf7fdad15d910fc27bc9334faab5b71c101455e1a
InstCombine: Turn umul_with_overflow into mul nuw if we can prove that it cannot overflow.

This happens a lot in clang-compiled C++ code because it adds overflow checks to operator new[]:
  unsigned *foo(unsigned n) { return new unsigned[n]; }
We can optimize away the overflow check on 64 bit targets because (uint64_t)n*4 cannot overflow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127418 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCalls.cpp
test/Transforms/InstCombine/intrinsics.ll