[llvm-commits] [PATCH] Rotate constant folding bug
Cameron McInally
cameron.mcinally at nyu.edu
Tue Oct 11 18:06:26 PDT 2011
Hey guys,
Constant folding for the rotate operators does not work currently. Here's a
fix...
royale mcinally/llvm> svn diff
Index: lib/Support/APInt.cpp
===================================================================
--- lib/Support/APInt.cpp (revision 141748)
+++ lib/Support/APInt.cpp (working copy)
@@ -1334,8 +1334,8 @@
// Don't get too fancy, just use existing shift/or facilities
APInt hi(*this);
APInt lo(*this);
- hi.shl(rotateAmt);
- lo.lshr(BitWidth - rotateAmt);
+ hi = hi.shl(rotateAmt);
+ lo = lo.lshr(BitWidth - rotateAmt);
return hi | lo;
}
@@ -1349,8 +1349,8 @@
// Don't get too fancy, just use existing shift/or facilities
APInt hi(*this);
APInt lo(*this);
- lo.lshr(rotateAmt);
- hi.shl(BitWidth - rotateAmt);
+ lo = lo.lshr(rotateAmt);
+ hi = hi.shl(BitWidth - rotateAmt);
return hi | lo;
}
Tx,
Cameron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111011/312777fb/attachment.html>
More information about the llvm-commits
mailing list