[PATCH] D144316: [SCEV] Fix FoldID::addInteger(unsigned long I)
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 18:32:22 PST 2023
vitalybuka created this revision.
Herald added a project: All.
vitalybuka requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
"unsigned long" can be 8 bytes, but the code assumes 4.
This this the real root cause D122215 <https://reviews.llvm.org/D122215> was reverted.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144316
Files:
llvm/include/llvm/Analysis/ScalarEvolution.h
Index: llvm/include/llvm/Analysis/ScalarEvolution.h
===================================================================
--- llvm/include/llvm/Analysis/ScalarEvolution.h
+++ llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1300,7 +1300,14 @@
SmallVector<unsigned, 4> Bits;
public:
- void addInteger(unsigned long I) { Bits.push_back(I); }
+ void addInteger(unsigned long I) {
+ if (sizeof(long) == sizeof(int))
+ addInteger(unsigned(I));
+ else if (sizeof(long) == sizeof(long long))
+ addInteger((unsigned long long)I);
+ else
+ llvm_unreachable("unexpected sizeof(long)");
+ }
void addInteger(unsigned I) { Bits.push_back(I); }
void addInteger(int I) { Bits.push_back(I); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144316.498547.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230218/31c90d01/attachment.bin>
More information about the llvm-commits
mailing list