diff options
author | Peter Waller <peter.waller@arm.com> | 2021-10-28 12:14:52 +0000 |
---|---|---|
committer | Peter Waller <peter.waller@arm.com> | 2021-10-28 12:15:15 +0000 |
commit | 98f08752f76b80a509037986d620b402c48f5115 (patch) | |
tree | 1c86a3c2beed1bf9c5ade965a024f72f8703e20b /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 0a2708d2ae572b394ebe35b66ebc58143b9f40bf (diff) | |
download | llvm-98f08752f76b80a509037986d620b402c48f5115.zip llvm-98f08752f76b80a509037986d620b402c48f5115.tar.gz llvm-98f08752f76b80a509037986d620b402c48f5115.tar.bz2 |
[InstCombine][ConstantFolding] Make ConstantFoldLoadThroughBitcast TypeSize-aware
The newly added test previously caused the compiler to fail an
assertion. It looks like a strightforward TypeSize upgrade.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D112142
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 4cc3fcd..3ed3b89 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -352,9 +352,9 @@ Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, const DataLayout &DL) { do { Type *SrcTy = C->getType(); - uint64_t DestSize = DL.getTypeSizeInBits(DestTy); - uint64_t SrcSize = DL.getTypeSizeInBits(SrcTy); - if (SrcSize < DestSize) + TypeSize DestSize = DL.getTypeSizeInBits(DestTy); + TypeSize SrcSize = DL.getTypeSizeInBits(SrcTy); + if (!TypeSize::isKnownGE(SrcSize, DestSize)) return nullptr; // Catch the obvious splat cases (since all-zeros can coerce non-integral |