Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit d93e840

Browse files
committed
[HACK] Avoid truncate, zero-, sign-extending 16-to-16
1 parent 3fa7cf1 commit d93e840

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/Support/APInt.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,10 @@ double APInt::roundToDouble(bool isSigned) const {
914914

915915
// Truncate to new width.
916916
APInt APInt::trunc(unsigned width) const {
917+
if (width == BitWidth) {
918+
fprintf(stderr, "Truncating %d to %d\n", BitWidth, width);
919+
return *this;
920+
}
917921
assert(width < BitWidth && "Invalid APInt Truncate request");
918922
assert(width && "Can't truncate to 0 bits");
919923

@@ -937,6 +941,11 @@ APInt APInt::trunc(unsigned width) const {
937941

938942
// Sign extend to a new width.
939943
APInt APInt::sext(unsigned width) const {
944+
if (width == BitWidth) {
945+
fprintf(stderr, "Sign extending %d to %d\n", BitWidth, width);
946+
return *this;
947+
}
948+
940949
assert(width > BitWidth && "Invalid APInt SignExtend request");
941950

942951
if (width <= APINT_BITS_PER_WORD) {
@@ -978,6 +987,11 @@ APInt APInt::sext(unsigned width) const {
978987

979988
// Zero extend to a new width.
980989
APInt APInt::zext(unsigned width) const {
990+
if (width == BitWidth) {
991+
fprintf(stderr, "Zero extending %d to %d\n", BitWidth, width);
992+
return *this;
993+
}
994+
981995
assert(width > BitWidth && "Invalid APInt ZeroExtend request");
982996

983997
if (width <= APINT_BITS_PER_WORD)

0 commit comments

Comments
 (0)