[llvm] [SimplifyCFG] Replace unreachable switch lookup table holes with poison (PR #94990)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 03:24:35 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff f8d270474c14c6705c77971494505dbe4b6d55ae 65dd6538d4cda2895dfc1e2b9259ac29d5a44c3a --extensions cpp -- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index b934ed8576..1f265d648f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6534,21 +6534,21 @@ SwitchLookupTable::SwitchLookupTable(
if (SingleValue && !isa<PoisonValue>(CaseRes) && CaseRes != SingleValue)
SingleValue = isa<PoisonValue>(SingleValue) ? CaseRes : nullptr;
- // Fill in any holes in the table with the default result.
- if (Values.size() < TableSize) {
- assert(DefaultValue &&
- "Need a default value to fill the lookup table holes.");
- assert(DefaultValue->getType() == ValueType);
- for (uint64_t I = 0; I < TableSize; ++I) {
- if (!TableContents[I])
- TableContents[I] = DefaultValue;
- }
+ // Fill in any holes in the table with the default result.
+ if (Values.size() < TableSize) {
+ assert(DefaultValue &&
+ "Need a default value to fill the lookup table holes.");
+ assert(DefaultValue->getType() == ValueType);
+ for (uint64_t I = 0; I < TableSize; ++I) {
+ if (!TableContents[I])
+ TableContents[I] = DefaultValue;
+ }
- // If the default value is poison, all the holes are poison.
- bool DefaultValueIsPoison = isa<PoisonValue>(DefaultValue);
+ // If the default value is poison, all the holes are poison.
+ bool DefaultValueIsPoison = isa<PoisonValue>(DefaultValue);
- if (DefaultValue != SingleValue && !DefaultValueIsPoison)
- SingleValue = nullptr;
+ if (DefaultValue != SingleValue && !DefaultValueIsPoison)
+ SingleValue = nullptr;
}
// If each element in the table contains the same value, we only need to store
``````````
</details>
https://github.com/llvm/llvm-project/pull/94990
More information about the llvm-commits
mailing list