diff options
author | aengelke <engelke@in.tum.de> | 2024-05-19 16:38:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-19 16:38:53 +0200 |
commit | 0c7d268ba72767b70c7bf0bc8ae6422c509f94d8 (patch) | |
tree | 915cde02243120b72f9c4287df6c0ea9ee697c00 /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | |
parent | 10edb4991c12738e60843d55cd9edbf6d702d9eb (diff) | |
download | llvm-0c7d268ba72767b70c7bf0bc8ae6422c509f94d8.zip llvm-0c7d268ba72767b70c7bf0bc8ae6422c509f94d8.tar.gz llvm-0c7d268ba72767b70c7bf0bc8ae6422c509f94d8.tar.bz2 |
[CodeGen][SDAG] Skip preferred extend at O0 (#92643)
This is a pure optimization to avoid redundant extensions, but iterating
over all users is expensive, so don't do this at -O0.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 8fb6b11..35f8402 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -222,8 +222,10 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, if (!isa<AllocaInst>(I) || !StaticAllocaMap.count(cast<AllocaInst>(&I))) InitializeRegForValue(&I); - // Decide the preferred extend type for a value. - PreferredExtendType[&I] = getPreferredExtendForValue(&I); + // Decide the preferred extend type for a value. This iterates over all + // users and therefore isn't cheap, so don't do this at O0. + if (DAG->getOptLevel() != CodeGenOptLevel::None) + PreferredExtendType[&I] = getPreferredExtendForValue(&I); } } |