[llvm] [SCCP] get rid of potentially dangling iterator (PR #105609)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 20:46:54 PDT 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 359c704004ec0826059578c79974d9ea29a8fbff 0c74cfdff70cc11edbfa3b1409beb504361e5a60 --extensions cpp,h -- llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index 05442c026f..1f67ca0487 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -189,8 +189,8 @@ class InstCostVisitor : public InstVisitor<InstCostVisitor, Constant *> {
// (some of their incoming values may have become constant or dead).
SmallVector<Instruction *> PendingPHIs;
- Value* LastVisitedUse = nullptr;
- Constant* LastVisitedConstant = nullptr;
+ Value *LastVisitedUse = nullptr;
+ Constant *LastVisitedConstant = nullptr;
public:
InstCostVisitor(const DataLayout &DL, BlockFrequencyInfo &BFI,
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 63b74733f6..195bd7418f 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -430,8 +430,8 @@ Constant *InstCostVisitor::visitSelectInst(SelectInst &I) {
if (I.getCondition() != LastVisitedUse)
return nullptr;
- Value *V = LastVisitedConstant->isZeroValue() ? I.getFalseValue()
- : I.getTrueValue();
+ Value *V =
+ LastVisitedConstant->isZeroValue() ? I.getFalseValue() : I.getTrueValue();
Constant *C = findConstantFor(V, KnownConstants);
return C;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/105609
More information about the llvm-commits
mailing list