diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-10-05 00:50:57 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-10-05 00:50:57 +0000 |
| commit | c41b0fcb1599ed0c84b68d0aa5ae4398fb0e910c (patch) | |
| tree | 74486779355156546d005faefb4e84da9a20ea23 | |
| parent | 481886517c4d366d1f59265b4f4ef84837f3d734 (diff) | |
| download | external_llvm-c41b0fcb1599ed0c84b68d0aa5ae4398fb0e910c.zip external_llvm-c41b0fcb1599ed0c84b68d0aa5ae4398fb0e910c.tar.gz external_llvm-c41b0fcb1599ed0c84b68d0aa5ae4398fb0e910c.tar.bz2 | |
fix a bug where the bswap matcher could match a case involving
ashr. It should only apply to lshr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57089 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 4f48971..95ed49d 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -3912,9 +3912,12 @@ static bool CollectBSwapParts(Value *V, SmallVector<Value*, 8> &ByteValues) { if (I->getOpcode() == Instruction::Shl) { // X << 24 defines the top byte with the lowest of the input bytes. DestNo = ByteValues.size()-1; - } else { + } else if (I->getOpcode() == Instruction::LShr) { // X >>u 24 defines the low byte with the highest of the input bytes. DestNo = 0; + } else { + // Arithmetic shift right may have the top bits set. + return true; } // If the destination byte value is already defined, the values are or'd |
