[llvm] r316481 - bpf: fix a bug in trunc-op optimization

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 14:19:21 PDT 2017


All stores to curr_func_ are dominated by loads, this can't be right.
You probably meant to initialize it to nullptr in the constructor?

On Tue, Oct 24, 2017 at 2:17 PM, Evgenii Stepanov
<eugeni.stepanov at gmail.com> wrote:
> Hi,
>
> one of your changes broke the msan bot:
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan/builds/202/steps/check-llvm%20msan/logs/stdio
>
> On Tue, Oct 24, 2017 at 11:21 AM, Yonghong Song via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: yhs
>> Date: Tue Oct 24 11:21:10 2017
>> New Revision: 316481
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=316481&view=rev
>> Log:
>> 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 at fb.com>
>>
>> Modified:
>>     llvm/trunk/lib/Target/BPF/BPFISelDAGToDAG.cpp
>>
>> Modified: llvm/trunk/lib/Target/BPF/BPFISelDAGToDAG.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFISelDAGToDAG.cpp?rev=316481&r1=316480&r2=316481&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/BPF/BPFISelDAGToDAG.cpp (original)
>> +++ llvm/trunk/lib/Target/BPF/BPFISelDAGToDAG.cpp Tue Oct 24 11:21:10 2017
>> @@ -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();
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list