Skip to content

Commit

Permalink
Don't overflow bit size (rust-lang#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Apr 23, 2022
1 parent bc1ffd0 commit 05f74fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4286,8 +4286,13 @@ FnTypeInfo::knownIntegralValues(llvm::Value *val, const DominatorTree &DT,
std::map<Value *, std::set<int64_t>> &intseen,
ScalarEvolution &SE) const {
if (auto constant = dyn_cast<ConstantInt>(val)) {
// if (constant->getValue().getSignificantBits() > 64)
// return {};
#if LLVM_VERSION_MAJOR > 14
if (constant->getValue().getSignificantBits() > 64)
return {};
#else
if (constant->getValue().getMinSignedBits() > 64)
return {};
#endif
return {constant->getSExtValue()};
}

Expand Down

0 comments on commit 05f74fc

Please sign in to comment.