aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/NaCl/expand-arith-with-overflow.ll
AgeCommit message (Collapse)Author
2013-06-10PNaCl: Extend ExpandStructRegs to handle "insertvalue" instructionsMark Seaborn
Previously, the pass could expand out struct_load+extractvalue combinations (via ReplaceUsesOfStructWithFields()). This change makes the pass more general by converting struct_loads to scalar_load+insertvalue combinations and then by expanding out insertvalue+extractvalue combinations. This means the pass can now handle the insertvalue instructions that are sometimes generated by the SROA pass. (Clang compiles ScummVM's use of C++ method pointers to struct loads+stores which SROA generates insertvalue instructions from.) To make the pass more general, we also extend it to be able to handle phi nodes of struct type. These are split into extractvalue+scalar_phi+insertvalue combinations. However, the pass is not yet fully general, because it doesn't handle: * nested struct types * array types Change ExpandArithWithOverflow to rely on ExpandStructRegs' insertvalue handling rather than the less general ReplaceUsesOfStructWithFields() helper function, which can now be removed. SplitUpStore() no longer needs to handle Constants, because this case is handled by ExpandExtractValue(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3476 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16448006
2013-05-28PNaCl: Extend ExpandMulWithOverflow pass to handle uadd.with.overflow tooMark Seaborn
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