Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #1413 (cherry-pick #179 to release_18x) #185

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,11 @@ bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager &CodeGenPasses,
raw_pwrite_stream &OS,
raw_pwrite_stream *DwoOS) {
// Add LibraryInfo.
std::unique_ptr<TargetLibraryInfoImpl> TLII(
llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
bool TargetHasAVX512 =
std::find(TargetOpts.Features.begin(), TargetOpts.Features.end(),
"+avx512f") != TargetOpts.Features.end();
std::unique_ptr<TargetLibraryInfoImpl> TLII(llvm::driver::createTLII(
TargetTriple, CodeGenOpts.getVecLib(), TargetHasAVX512));
CodeGenPasses.add(new TargetLibraryInfoWrapperPass(*TLII));

// Normal mode, emit a .s or .o file by running the code generator. Note,
Expand Down Expand Up @@ -890,8 +893,11 @@ void EmitAssemblyHelper::RunOptimizationPipeline(

// Register the target library analysis directly and give it a customized
// preset TLI.
std::unique_ptr<TargetLibraryInfoImpl> TLII(
llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
bool TargetHasAVX512 =
std::find(TargetOpts.Features.begin(), TargetOpts.Features.end(),
"+avx512f") != TargetOpts.Features.end();
std::unique_ptr<TargetLibraryInfoImpl> TLII(llvm::driver::createTLII(
TargetTriple, CodeGenOpts.getVecLib(), TargetHasAVX512));
FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });

// Register all the basic analyses with the managers.
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/TargetLibraryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class TargetLibraryInfoImpl {
MASSV, // IBM MASS vector library.
#ifdef ENABLE_CLASSIC_FLANG
PGMATH, // PGI math library.
PGMATH_AVX512, // PGI math library (AVX512 subset).
#endif
SVML, // Intel short vector math library.
SLEEFGNUABI, // SLEEF - SIMD Library for Evaluating Elementary Functions.
Expand Down
Loading
Loading