Skip to content

Commit bb7e879

Browse files
authored
Optionally disable type warning (rust-lang#437)
1 parent 0569021 commit bb7e879

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

enzyme/Enzyme/TypeAnalysis/TypeTree.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ extern "C" {
4242
llvm::cl::opt<int> MaxTypeOffset("enzyme-max-type-offset", cl::init(500),
4343
cl::Hidden,
4444
cl::desc("Maximum type tree offset"));
45+
llvm::cl::opt<bool> EnzymeTypeWarning("enzyme-type-warning", cl::init(true),
46+
cl::Hidden,
47+
cl::desc("Print Type Depth Warning"));
4548
}
4649

4750
// TODO keep type information that is striated
@@ -117,4 +120,4 @@ TypeTree TypeTree::KeepForCast(const llvm::DataLayout &DL, llvm::Type *From,
117120
}
118121
}
119122
return Result;
120-
}
123+
}

enzyme/Enzyme/TypeAnalysis/TypeTree.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
/// Maximum offset for type trees to keep
4545
extern "C" {
4646
extern llvm::cl::opt<int> MaxTypeOffset;
47+
extern llvm::cl::opt<bool> EnzymeTypeWarning;
4748
}
4849

4950
/// Helper function to print a vector of ints to a string
@@ -277,9 +278,10 @@ class TypeTree : public std::enable_shared_from_this<TypeTree> {
277278
}
278279
}
279280
if (Seq.size() > 6) {
280-
llvm::errs() << "not handling more than 6 pointer lookups deep dt:"
281-
<< str() << " adding v: " << to_string(Seq) << ": "
282-
<< CT.str() << "\n";
281+
if (EnzymeTypeWarning)
282+
llvm::errs() << "not handling more than 6 pointer lookups deep dt:"
283+
<< str() << " adding v: " << to_string(Seq) << ": "
284+
<< CT.str() << "\n";
283285
return changed;
284286
}
285287

0 commit comments

Comments
 (0)