[all-commits] [llvm/llvm-project] 48c74b: [SampleProfileInference] Work around odr-use of co...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Mar 8 14:35:10 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 48c74bb2e2a72830f1068823bfc2f6fd4b53d427
      https://github.com/llvm/llvm-project/commit/48c74bb2e2a72830f1068823bfc2f6fd4b53d427
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/SampleProfileInference.cpp

  Log Message:
  -----------
  [SampleProfileInference] Work around odr-use of const non-inline static data member to fix -O0 builds after D120508

MinBaseDistance may be odr-used by std::max, leading to an undefined symbol linker error:

```
ld.lld: error: undefined symbol: (anonymous namespace)::MinCostMaxFlow::MinBaseDistance
>>> referenced by SampleProfileInference.cpp:744 (/home/ray/llvm-project/llvm/lib/Transforms/Utils/SampleProfileInference.cpp:744)
>>>               lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SampleProfileInference.cpp.o:((anonymous namespace)::FlowAdjuster::jumpDistance(llvm::FlowJump*) const)
```

Since llvm-project is still using C++ 14, workaround it with a cast.




More information about the All-commits mailing list