diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-05-28 11:54:06 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-05-28 11:54:06 -0700 |
commit | 9a6f5fa4707744e76c4c89e6c569fea7b9f81fac (patch) | |
tree | 7cdcefa3960c8a641ae05baf572f57450f029fe5 /lib/Transforms/NaCl/PNaClABISimplify.cpp | |
parent | 7b1d0b48c95f7b9861b890c650f039d5cc636e89 (diff) |
PNaCl: Extend ExpandMulWithOverflow pass to handle uadd.with.overflow too
It turned out that umul.with.overflow wasn't the only *.with.overflow
intrinsic usage introduced by Clang.
I knew that Clang's CGExprCXX.cpp generates umul.with.overflow for an
overflow check for C++'s "new Foo[]". The same code for handling "new
Foo[]" also generates uadd.with.overflow in some cases. This happens
if class Foo has a destructor or a delete[] operator that takes a size
argument. In those cases, the C++ ABI adds a "cookie" to the
allocation which contains the array's size.
Rename the pass to "ExpandArithWithOverflow" and rename files
accordingly.
Also enable the pass.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434
TEST=*.ll tests + trybots + GCC torture tests
Review URL: https://codereview.chromium.org/15688011
Diffstat (limited to 'lib/Transforms/NaCl/PNaClABISimplify.cpp')
-rw-r--r-- | lib/Transforms/NaCl/PNaClABISimplify.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp index 37504517d6..47e5fb67e6 100644 --- a/lib/Transforms/NaCl/PNaClABISimplify.cpp +++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp @@ -28,6 +28,7 @@ void llvm::PNaClABISimplifyAddPreOptPasses(PassManager &PM) { // Remove landingpad blocks made unreachable by LowerInvoke. PM.add(createCFGSimplificationPass()); + PM.add(createExpandArithWithOverflowPass()); PM.add(createExpandVarArgsPass()); PM.add(createExpandCtorsPass()); PM.add(createResolveAliasesPass()); |