Skip to content

Commit 05f74fc

Browse files
authored
Don't overflow bit size (rust-lang#600)
1 parent bc1ffd0 commit 05f74fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4286,8 +4286,13 @@ FnTypeInfo::knownIntegralValues(llvm::Value *val, const DominatorTree &DT,
42864286
std::map<Value *, std::set<int64_t>> &intseen,
42874287
ScalarEvolution &SE) const {
42884288
if (auto constant = dyn_cast<ConstantInt>(val)) {
4289-
// if (constant->getValue().getSignificantBits() > 64)
4290-
// return {};
4289+
#if LLVM_VERSION_MAJOR > 14
4290+
if (constant->getValue().getSignificantBits() > 64)
4291+
return {};
4292+
#else
4293+
if (constant->getValue().getMinSignedBits() > 64)
4294+
return {};
4295+
#endif
42914296
return {constant->getSExtValue()};
42924297
}
42934298

0 commit comments

Comments
 (0)