mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
bpf: fix a bug in trunc-op optimization
Previous implementation for per-function scope is incorrect and too conservative. Signed-off-by: Yonghong Song <yhs@fb.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316481 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -85,6 +85,8 @@ private:
|
||||
std::map<const void *, val_vec_type> cs_vals_;
|
||||
// Mapping from vreg to load memory opcode
|
||||
std::map<unsigned, unsigned> load_to_vreg_;
|
||||
// Current function
|
||||
const Function *curr_func_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -332,7 +334,12 @@ void BPFDAGToDAGISel::PreprocessISelDAG() {
|
||||
|
||||
// clear the load_to_vreg_ map so that we have a clean start
|
||||
// for this function.
|
||||
load_to_vreg_.clear();
|
||||
if (!curr_func_) {
|
||||
curr_func_ = FuncInfo->Fn;
|
||||
} else if (curr_func_ != FuncInfo->Fn) {
|
||||
load_to_vreg_.clear();
|
||||
curr_func_ = FuncInfo->Fn;
|
||||
}
|
||||
|
||||
for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
|
||||
E = CurDAG->allnodes_end();
|
||||
|
||||
Reference in New Issue
Block a user