[llvm-branch-commits] [clang] release/19.x: [clang][modules] Enable built-in modules for the upcoming Apple releases (#102239) (PR #102335)
@@ -2923,22 +2923,47 @@ bool Darwin::isAlignedAllocationUnavailable() const { return TargetVersion < alignedAllocMinVersion(OS); } -static bool sdkSupportsBuiltinModules(const Darwin::DarwinPlatformKind &TargetPlatform, const std::optional &SDKInfo) { +static bool sdkSupportsBuiltinModules( +const Darwin::DarwinPlatformKind &TargetPlatform, +const Darwin::DarwinEnvironmentKind &TargetEnvironment, +const std::optional &SDKInfo) { + switch (TargetEnvironment) { + case Darwin::NativeEnvironment: + case Darwin::Simulator: + case Darwin::MacCatalyst: +// Standard xnu/Mach/Darwin based environments +// depend on the SDK version. +break; + default: kazutakahirata wrote: Will do next time. Thanks! https://github.com/llvm/llvm-project/pull/102335 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] f40ed13 - [Driver] Use StringSet::contains (NFC)
Author: Kazu Hirata Date: 2023-10-25T20:14:35-07:00 New Revision: f40ed134b485db5f950f51a0d175caffe607b2f1 URL: https://github.com/llvm/llvm-project/commit/f40ed134b485db5f950f51a0d175caffe607b2f1 DIFF: https://github.com/llvm/llvm-project/commit/f40ed134b485db5f950f51a0d175caffe607b2f1.diff LOG: [Driver] Use StringSet::contains (NFC) Added: Modified: clang/lib/Driver/Driver.cpp Removed: diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index f5fd900a6447fe3..30ae2201ab8 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -2593,7 +2593,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, // Warn -x after last input file has no effect auto LastXArg = Args.getLastArgValue(options::OPT_x); const llvm::StringSet<> ValidXArgs = {"cuda", "hip", "cui", "hipi"}; - if (!IsCLMode() || ValidXArgs.find(LastXArg) != ValidXArgs.end()) { + if (!IsCLMode() || ValidXArgs.contains(LastXArg)) { Arg *LastXArg = Args.getLastArgNoClaim(options::OPT_x); Arg *LastInputArg = Args.getLastArgNoClaim(options::OPT_INPUT); if (LastXArg && LastInputArg && ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6b4812f - [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:19:25-08:00 New Revision: 6b4812f722ca0ddfe93cee194074dda56e1cb497 URL: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497 DIFF: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497.diff LOG: [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC) Identified with clangd. Added: Modified: llvm/tools/llvm-objdump/llvm-objdump.cpp Removed: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 2b7dee7bf46b9..631ca955776d4 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -24,7 +24,6 @@ #include "SourcePrinter.h" #include "WasmDump.h" #include "XCOFFDump.h" -#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/StringExtras.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f6d6809 - [llvm] Stop including array (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:52:25-08:00 New Revision: f6d6809d787b7f5d150715aa475f71bca083aebd URL: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd DIFF: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd.diff LOG: [llvm] Stop including array (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Support/TypeSize.h llvm/include/llvm/XRay/BlockVerifier.h llvm/lib/Target/ARM/ARMHazardRecognizer.h llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 08ab7c9024f75..4d9d4f400e927 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -20,7 +20,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include #include #include diff --git a/llvm/include/llvm/XRay/BlockVerifier.h b/llvm/include/llvm/XRay/BlockVerifier.h index 0175584d8235e..0bfbbb6c5b076 100644 --- a/llvm/include/llvm/XRay/BlockVerifier.h +++ b/llvm/include/llvm/XRay/BlockVerifier.h @@ -14,7 +14,6 @@ #define LLVM_XRAY_BLOCKVERIFIER_H #include "llvm/XRay/FDRRecords.h" -#include #include namespace llvm { diff --git a/llvm/lib/Target/ARM/ARMHazardRecognizer.h b/llvm/lib/Target/ARM/ARMHazardRecognizer.h index 66a1477e5e082..b9ac3555c2bc3 100644 --- a/llvm/lib/Target/ARM/ARMHazardRecognizer.h +++ b/llvm/lib/Target/ARM/ARMHazardRecognizer.h @@ -18,7 +18,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/Support/DataTypes.h" -#include #include namespace llvm { diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index 5db9123ef48f7..2b17f98bb75b2 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -9,7 +9,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 96d0a3b - [llvm] Stop including optional (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:31:07-08:00 New Revision: 96d0a3b5643a2081e39c9302c86b40859a8752d0 URL: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0 DIFF: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0.diff LOG: [llvm] Stop including optional (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Analysis/BasicAliasAnalysis.h llvm/include/llvm/Analysis/DemandedBits.h llvm/include/llvm/IRReader/IRReader.h llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index ca67e0905c5f..afc1811239f2 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -18,7 +18,6 @@ #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include -#include #include namespace llvm { diff --git a/llvm/include/llvm/Analysis/DemandedBits.h b/llvm/include/llvm/Analysis/DemandedBits.h index d7709b742378..6e4bfcf899c9 100644 --- a/llvm/include/llvm/Analysis/DemandedBits.h +++ b/llvm/include/llvm/Analysis/DemandedBits.h @@ -25,7 +25,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/PassManager.h" -#include namespace llvm { diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h index 4d690dcaf1c4..099b958efb0c 100644 --- a/llvm/include/llvm/IRReader/IRReader.h +++ b/llvm/include/llvm/IRReader/IRReader.h @@ -17,7 +17,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Bitcode/BitcodeReader.h" #include -#include namespace llvm { diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index ae7f1743b523..09b3ab96974c 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -22,7 +22,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include using namespace llvm; diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index c0b708e277f2..5db9123ef48f 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -10,7 +10,6 @@ #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" #include -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6b4812f - [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:19:25-08:00 New Revision: 6b4812f722ca0ddfe93cee194074dda56e1cb497 URL: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497 DIFF: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497.diff LOG: [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC) Identified with clangd. Added: Modified: llvm/tools/llvm-objdump/llvm-objdump.cpp Removed: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 2b7dee7bf46b9..631ca955776d4 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -24,7 +24,6 @@ #include "SourcePrinter.h" #include "WasmDump.h" #include "XCOFFDump.h" -#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/StringExtras.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 96d0a3b - [llvm] Stop including optional (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:31:07-08:00 New Revision: 96d0a3b5643a2081e39c9302c86b40859a8752d0 URL: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0 DIFF: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0.diff LOG: [llvm] Stop including optional (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Analysis/BasicAliasAnalysis.h llvm/include/llvm/Analysis/DemandedBits.h llvm/include/llvm/IRReader/IRReader.h llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index ca67e0905c5f..afc1811239f2 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -18,7 +18,6 @@ #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include -#include #include namespace llvm { diff --git a/llvm/include/llvm/Analysis/DemandedBits.h b/llvm/include/llvm/Analysis/DemandedBits.h index d7709b742378..6e4bfcf899c9 100644 --- a/llvm/include/llvm/Analysis/DemandedBits.h +++ b/llvm/include/llvm/Analysis/DemandedBits.h @@ -25,7 +25,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/PassManager.h" -#include namespace llvm { diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h index 4d690dcaf1c4..099b958efb0c 100644 --- a/llvm/include/llvm/IRReader/IRReader.h +++ b/llvm/include/llvm/IRReader/IRReader.h @@ -17,7 +17,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Bitcode/BitcodeReader.h" #include -#include namespace llvm { diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index ae7f1743b523..09b3ab96974c 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -22,7 +22,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include using namespace llvm; diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index c0b708e277f2..5db9123ef48f 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -10,7 +10,6 @@ #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" #include -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f6d6809 - [llvm] Stop including array (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:52:25-08:00 New Revision: f6d6809d787b7f5d150715aa475f71bca083aebd URL: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd DIFF: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd.diff LOG: [llvm] Stop including array (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Support/TypeSize.h llvm/include/llvm/XRay/BlockVerifier.h llvm/lib/Target/ARM/ARMHazardRecognizer.h llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 08ab7c9024f75..4d9d4f400e927 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -20,7 +20,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include #include #include diff --git a/llvm/include/llvm/XRay/BlockVerifier.h b/llvm/include/llvm/XRay/BlockVerifier.h index 0175584d8235e..0bfbbb6c5b076 100644 --- a/llvm/include/llvm/XRay/BlockVerifier.h +++ b/llvm/include/llvm/XRay/BlockVerifier.h @@ -14,7 +14,6 @@ #define LLVM_XRAY_BLOCKVERIFIER_H #include "llvm/XRay/FDRRecords.h" -#include #include namespace llvm { diff --git a/llvm/lib/Target/ARM/ARMHazardRecognizer.h b/llvm/lib/Target/ARM/ARMHazardRecognizer.h index 66a1477e5e082..b9ac3555c2bc3 100644 --- a/llvm/lib/Target/ARM/ARMHazardRecognizer.h +++ b/llvm/lib/Target/ARM/ARMHazardRecognizer.h @@ -18,7 +18,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/Support/DataTypes.h" -#include #include namespace llvm { diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index 5db9123ef48f7..2b17f98bb75b2 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -9,7 +9,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6b4812f - [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:19:25-08:00 New Revision: 6b4812f722ca0ddfe93cee194074dda56e1cb497 URL: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497 DIFF: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497.diff LOG: [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC) Identified with clangd. Added: Modified: llvm/tools/llvm-objdump/llvm-objdump.cpp Removed: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 2b7dee7bf46b9..631ca955776d4 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -24,7 +24,6 @@ #include "SourcePrinter.h" #include "WasmDump.h" #include "XCOFFDump.h" -#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/StringExtras.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 96d0a3b - [llvm] Stop including optional (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:31:07-08:00 New Revision: 96d0a3b5643a2081e39c9302c86b40859a8752d0 URL: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0 DIFF: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0.diff LOG: [llvm] Stop including optional (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Analysis/BasicAliasAnalysis.h llvm/include/llvm/Analysis/DemandedBits.h llvm/include/llvm/IRReader/IRReader.h llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index ca67e0905c5f6..afc1811239f28 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -18,7 +18,6 @@ #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include -#include #include namespace llvm { diff --git a/llvm/include/llvm/Analysis/DemandedBits.h b/llvm/include/llvm/Analysis/DemandedBits.h index d7709b7423784..6e4bfcf899c90 100644 --- a/llvm/include/llvm/Analysis/DemandedBits.h +++ b/llvm/include/llvm/Analysis/DemandedBits.h @@ -25,7 +25,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/PassManager.h" -#include namespace llvm { diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h index 4d690dcaf1c43..099b958efb0c6 100644 --- a/llvm/include/llvm/IRReader/IRReader.h +++ b/llvm/include/llvm/IRReader/IRReader.h @@ -17,7 +17,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Bitcode/BitcodeReader.h" #include -#include namespace llvm { diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index ae7f1743b5239..09b3ab96974c4 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -22,7 +22,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include using namespace llvm; diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index c0b708e277f20..5db9123ef48f7 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -10,7 +10,6 @@ #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" #include -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f6d6809 - [llvm] Stop including array (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:52:25-08:00 New Revision: f6d6809d787b7f5d150715aa475f71bca083aebd URL: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd DIFF: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd.diff LOG: [llvm] Stop including array (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Support/TypeSize.h llvm/include/llvm/XRay/BlockVerifier.h llvm/lib/Target/ARM/ARMHazardRecognizer.h llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 08ab7c9024f75..4d9d4f400e927 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -20,7 +20,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include #include #include diff --git a/llvm/include/llvm/XRay/BlockVerifier.h b/llvm/include/llvm/XRay/BlockVerifier.h index 0175584d8235e..0bfbbb6c5b076 100644 --- a/llvm/include/llvm/XRay/BlockVerifier.h +++ b/llvm/include/llvm/XRay/BlockVerifier.h @@ -14,7 +14,6 @@ #define LLVM_XRAY_BLOCKVERIFIER_H #include "llvm/XRay/FDRRecords.h" -#include #include namespace llvm { diff --git a/llvm/lib/Target/ARM/ARMHazardRecognizer.h b/llvm/lib/Target/ARM/ARMHazardRecognizer.h index 66a1477e5e082..b9ac3555c2bc3 100644 --- a/llvm/lib/Target/ARM/ARMHazardRecognizer.h +++ b/llvm/lib/Target/ARM/ARMHazardRecognizer.h @@ -18,7 +18,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/Support/DataTypes.h" -#include #include namespace llvm { diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index 5db9123ef48f7..2b17f98bb75b2 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -9,7 +9,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6b4812f - [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:19:25-08:00 New Revision: 6b4812f722ca0ddfe93cee194074dda56e1cb497 URL: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497 DIFF: https://github.com/llvm/llvm-project/commit/6b4812f722ca0ddfe93cee194074dda56e1cb497.diff LOG: [llvm-objdump] Stop including llvm/ADT/IndexedMap.h (NFC) Identified with clangd. Added: Modified: llvm/tools/llvm-objdump/llvm-objdump.cpp Removed: diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 2b7dee7bf46b..631ca955776d 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -24,7 +24,6 @@ #include "SourcePrinter.h" #include "WasmDump.h" #include "XCOFFDump.h" -#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/StringExtras.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 96d0a3b - [llvm] Stop including optional (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:31:07-08:00 New Revision: 96d0a3b5643a2081e39c9302c86b40859a8752d0 URL: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0 DIFF: https://github.com/llvm/llvm-project/commit/96d0a3b5643a2081e39c9302c86b40859a8752d0.diff LOG: [llvm] Stop including optional (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Analysis/BasicAliasAnalysis.h llvm/include/llvm/Analysis/DemandedBits.h llvm/include/llvm/IRReader/IRReader.h llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h index ca67e0905c5f6..afc1811239f28 100644 --- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h +++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h @@ -18,7 +18,6 @@ #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" #include -#include #include namespace llvm { diff --git a/llvm/include/llvm/Analysis/DemandedBits.h b/llvm/include/llvm/Analysis/DemandedBits.h index d7709b7423784..6e4bfcf899c90 100644 --- a/llvm/include/llvm/Analysis/DemandedBits.h +++ b/llvm/include/llvm/Analysis/DemandedBits.h @@ -25,7 +25,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/PassManager.h" -#include namespace llvm { diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h index 4d690dcaf1c43..099b958efb0c6 100644 --- a/llvm/include/llvm/IRReader/IRReader.h +++ b/llvm/include/llvm/IRReader/IRReader.h @@ -17,7 +17,6 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Bitcode/BitcodeReader.h" #include -#include namespace llvm { diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index ae7f1743b5239..09b3ab96974c4 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -22,7 +22,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include using namespace llvm; diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index c0b708e277f20..5db9123ef48f7 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -10,7 +10,6 @@ #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" #include -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f6d6809 - [llvm] Stop including array (NFC)
Author: Kazu Hirata Date: 2023-12-02T00:52:25-08:00 New Revision: f6d6809d787b7f5d150715aa475f71bca083aebd URL: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd DIFF: https://github.com/llvm/llvm-project/commit/f6d6809d787b7f5d150715aa475f71bca083aebd.diff LOG: [llvm] Stop including array (NFC) Identified with clangd. Added: Modified: llvm/include/llvm/Support/TypeSize.h llvm/include/llvm/XRay/BlockVerifier.h llvm/lib/Target/ARM/ARMHazardRecognizer.h llvm/unittests/Support/DivisionByConstantTest.cpp Removed: diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h index 08ab7c9024f75..4d9d4f400e927 100644 --- a/llvm/include/llvm/Support/TypeSize.h +++ b/llvm/include/llvm/Support/TypeSize.h @@ -20,7 +20,6 @@ #include "llvm/Support/raw_ostream.h" #include -#include #include #include #include diff --git a/llvm/include/llvm/XRay/BlockVerifier.h b/llvm/include/llvm/XRay/BlockVerifier.h index 0175584d8235e..0bfbbb6c5b076 100644 --- a/llvm/include/llvm/XRay/BlockVerifier.h +++ b/llvm/include/llvm/XRay/BlockVerifier.h @@ -14,7 +14,6 @@ #define LLVM_XRAY_BLOCKVERIFIER_H #include "llvm/XRay/FDRRecords.h" -#include #include namespace llvm { diff --git a/llvm/lib/Target/ARM/ARMHazardRecognizer.h b/llvm/lib/Target/ARM/ARMHazardRecognizer.h index 66a1477e5e082..b9ac3555c2bc3 100644 --- a/llvm/lib/Target/ARM/ARMHazardRecognizer.h +++ b/llvm/lib/Target/ARM/ARMHazardRecognizer.h @@ -18,7 +18,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/Support/DataTypes.h" -#include #include namespace llvm { diff --git a/llvm/unittests/Support/DivisionByConstantTest.cpp b/llvm/unittests/Support/DivisionByConstantTest.cpp index 5db9123ef48f7..2b17f98bb75b2 100644 --- a/llvm/unittests/Support/DivisionByConstantTest.cpp +++ b/llvm/unittests/Support/DivisionByConstantTest.cpp @@ -9,7 +9,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/Support/DivisionByConstantInfo.h" #include "gtest/gtest.h" -#include using namespace llvm; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a325490 - [Analysis] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-22T23:25:01-08:00 New Revision: a3254904b28cbc392baa8011f1da8172538ff077 URL: https://github.com/llvm/llvm-project/commit/a3254904b28cbc392baa8011f1da8172538ff077 DIFF: https://github.com/llvm/llvm-project/commit/a3254904b28cbc392baa8011f1da8172538ff077.diff LOG: [Analysis] Use llvm::append_range (NFC) Added: Modified: llvm/lib/Analysis/BasicAliasAnalysis.cpp llvm/lib/Analysis/DDG.cpp llvm/lib/Analysis/DependenceGraphBuilder.cpp llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp llvm/lib/Analysis/LoopCacheAnalysis.cpp llvm/lib/Analysis/LoopNestAnalysis.cpp llvm/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/lib/Analysis/MustExecute.cpp llvm/lib/Analysis/ValueTracking.cpp Removed: diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 3d638c1c36ce..97d0cb63ef99 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -652,8 +652,7 @@ bool BasicAAResult::pointsToConstantMemory(const MemoryLocation &Loc, Visited.clear(); return AAResultBase::pointsToConstantMemory(Loc, AAQI, OrLocal); } - for (Value *IncValue : PN->incoming_values()) -Worklist.push_back(IncValue); + append_range(Worklist, PN->incoming_values()); continue; } diff --git a/llvm/lib/Analysis/DDG.cpp b/llvm/lib/Analysis/DDG.cpp index b2aa322454e7..da5de75a038c 100644 --- a/llvm/lib/Analysis/DDG.cpp +++ b/llvm/lib/Analysis/DDG.cpp @@ -190,8 +190,7 @@ DataDependenceGraph::DataDependenceGraph(Function &F, DependenceInfo &D) // directions. BasicBlockListType BBList; for (auto &SCC : make_range(scc_begin(&F), scc_end(&F))) -for (BasicBlock * BB : SCC) - BBList.push_back(BB); +append_range(BBList, SCC); std::reverse(BBList.begin(), BBList.end()); DDGBuilder(*this, D, BBList).populate(); } @@ -207,8 +206,7 @@ DataDependenceGraph::DataDependenceGraph(Loop &L, LoopInfo &LI, LoopBlocksDFS DFS(&L); DFS.perform(&LI); BasicBlockListType BBList; - for (BasicBlock *BB : make_range(DFS.beginRPO(), DFS.endRPO())) -BBList.push_back(BB); + append_range(BBList, make_range(DFS.beginRPO(), DFS.endRPO())); DDGBuilder(*this, D, BBList).populate(); } diff --git a/llvm/lib/Analysis/DependenceGraphBuilder.cpp b/llvm/lib/Analysis/DependenceGraphBuilder.cpp index 04a34472659c..6b90db4bafe1 100644 --- a/llvm/lib/Analysis/DependenceGraphBuilder.cpp +++ b/llvm/lib/Analysis/DependenceGraphBuilder.cpp @@ -498,8 +498,7 @@ void AbstractDependenceGraphBuilder::sortNodesTopologically() { size_t OldSize = Graph.Nodes.size(); Graph.Nodes.clear(); - for (NodeType *N : reverse(NodesInPO)) -Graph.Nodes.push_back(N); + append_range(Graph.Nodes, reverse(NodesInPO)); if (Graph.Nodes.size() != OldSize) assert(false && "Expected the number of nodes to stay the same after the sort"); diff --git a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp index 551add6900be..e138e82c8b05 100644 --- a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp +++ b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp @@ -331,8 +331,7 @@ TrainingLogger::TrainingLogger(StringRef LogFileName, FT.push_back( {TensorSpec::createSpec(FeatureNameMap.at(I), {1}), None}); if (MUTR && MUTR->outputLoggedFeatureSpecs().size() > 1) -FT.insert(FT.end(), MUTR->outputLoggedFeatureSpecs().begin() + 1, - MUTR->outputLoggedFeatureSpecs().end()); +append_range(FT, drop_begin(MUTR->outputLoggedFeatureSpecs())); DefaultDecisionPos = FT.size(); FT.push_back( @@ -465,8 +464,7 @@ ModelUnderTrainingRunner::ModelUnderTrainingRunner(LLVMContext &Ctx, for (size_t I = 0; I < NumberOfFeatures; ++I) InputSpecs.push_back( TensorSpec::createSpec(TFFeedPrefix + FeatureNameMap[I], {1})); - InputSpecs.insert(InputSpecs.end(), TrainingOnlyFeatures.begin(), -TrainingOnlyFeatures.end()); + append_range(InputSpecs, TrainingOnlyFeatures); if (auto MaybeOutSpecs = loadOutputSpecs(Ctx, DecisionName, ModelPath, TFOutputSpecOverride)) OutputSpecs = std::move(*MaybeOutSpecs); diff --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp index 6c490411d106..cf68596bfbc3 100644 --- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp +++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp @@ -505,8 +505,7 @@ CacheCost::getCacheCost(Loop &Root, LoopStandardAnalysisResults &AR, } LoopVectorTy Loops; - for (Loop *L : breadth_first(&Root)) -Loops.push_back(L); + append_range(Loops, breadth_first(&Root)); if (!getInnerMostLoop(Loops)) { LLVM_DEBUG(dbgs() << "Cannot compute cache cost of loop nest with more " diff --git a/llvm/lib/Analysis/LoopNestAnalysis.
[llvm-branch-commits] [llvm] 5f843b2 - [llvm] Use isAlpha/isAlnum (NFC)
Author: Kazu Hirata Date: 2021-01-22T23:25:03-08:00 New Revision: 5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7 URL: https://github.com/llvm/llvm-project/commit/5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7 DIFF: https://github.com/llvm/llvm-project/commit/5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7.diff LOG: [llvm] Use isAlpha/isAlnum (NFC) Added: Modified: llvm/include/llvm/Bitstream/BitCodes.h llvm/lib/IR/Mangler.cpp llvm/lib/MC/MCAsmInfo.cpp llvm/lib/Support/YAMLParser.cpp llvm/utils/TableGen/AsmMatcherEmitter.cpp llvm/utils/TableGen/AsmWriterEmitter.cpp llvm/utils/TableGen/AsmWriterInst.cpp Removed: diff --git a/llvm/include/llvm/Bitstream/BitCodes.h b/llvm/include/llvm/Bitstream/BitCodes.h index 41a3de3b20efc..9cd4e535a4701 100644 --- a/llvm/include/llvm/Bitstream/BitCodes.h +++ b/llvm/include/llvm/Bitstream/BitCodes.h @@ -18,6 +18,7 @@ #define LLVM_BITSTREAM_BITCODES_H #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ErrorHandling.h" #include @@ -137,13 +138,7 @@ class BitCodeAbbrevOp { } /// isChar6 - Return true if this character is legal in the Char6 encoding. - static bool isChar6(char C) { -if (C >= 'a' && C <= 'z') return true; -if (C >= 'A' && C <= 'Z') return true; -if (C >= '0' && C <= '9') return true; -if (C == '.' || C == '_') return true; -return false; - } + static bool isChar6(char C) { return isAlnum(C) || C == '.' || C == '_'; } static unsigned EncodeChar6(char C) { if (C >= 'a' && C <= 'z') return C-'a'; if (C >= 'A' && C <= 'Z') return C-'A'+26; diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp index 8536503cb6d80..674ba3cdaa24e 100644 --- a/llvm/lib/IR/Mangler.cpp +++ b/llvm/lib/IR/Mangler.cpp @@ -12,6 +12,7 @@ #include "llvm/IR/Mangler.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/DataLayout.h" @@ -186,8 +187,7 @@ void Mangler::getNameWithPrefix(SmallVectorImpl &OutName, // Check if the name needs quotes to be safe for the linker to interpret. static bool canBeUnquotedInDirective(char C) { - return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') || - (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@'; + return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@'; } static bool canBeUnquotedInDirective(StringRef Name) { diff --git a/llvm/lib/MC/MCAsmInfo.cpp b/llvm/lib/MC/MCAsmInfo.cpp index 0d2d26b0eb47c..620d3e7cffc30 100644 --- a/llvm/lib/MC/MCAsmInfo.cpp +++ b/llvm/lib/MC/MCAsmInfo.cpp @@ -109,8 +109,7 @@ MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, } bool MCAsmInfo::isAcceptableChar(char C) const { - return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') || - (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@'; + return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@'; } bool MCAsmInfo::isValidUnquotedName(StringRef Name) const { diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index 17321177105e6..f68ba0d065c1d 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -981,17 +981,9 @@ void Scanner::advanceWhile(SkipWhileFunc Func) { Current = Final; } -static bool is_ns_hex_digit(const char C) { - return(C >= '0' && C <= '9') - || (C >= 'a' && C <= 'z') - || (C >= 'A' && C <= 'Z'); -} +static bool is_ns_hex_digit(const char C) { return isAlnum(C); } -static bool is_ns_word_char(const char C) { - returnC == '-' - || (C >= 'a' && C <= 'z') - || (C >= 'A' && C <= 'Z'); -} +static bool is_ns_word_char(const char C) { return C == '-' || isAlpha(C); } void Scanner::scan_ns_uri_char() { while (true) { diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 48b7014e84af7..9d304910ba4e6 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -1112,9 +1112,7 @@ static std::string getEnumNameForToken(StringRef Str) { case '-': Res += "_MINUS_"; break; case '#': Res += "_HASH_"; break; default: - if ((*it >= 'A' && *it <= 'Z') || - (*it >= 'a' && *it <= 'z') || - (*it >= '0' && *it <= '9')) + if (isAlnum(*it)) Res += *it; else Res += "_" + utostr((unsigned) *it) + "_"; diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index a09ea775808c6..92df204475b9a 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -713,9 +713,7 @@ class IAPrinter { ++Next; } else { // $name, just eat the usual suspects. - while (I !=
[llvm-branch-commits] [llvm] 49231c1 - [llvm] Use static_assert instead of assert (NFC)
Author: Kazu Hirata Date: 2021-01-22T23:25:05-08:00 New Revision: 49231c1f80803ae0f15963cce708cedf6e44088f URL: https://github.com/llvm/llvm-project/commit/49231c1f80803ae0f15963cce708cedf6e44088f DIFF: https://github.com/llvm/llvm-project/commit/49231c1f80803ae0f15963cce708cedf6e44088f.diff LOG: [llvm] Use static_assert instead of assert (NFC) Identified with misc-static-assert. Added: Modified: llvm/include/llvm/IR/InstrTypes.h llvm/lib/Object/XCOFFObjectFile.cpp llvm/lib/Support/SHA1.cpp llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp llvm/lib/Target/X86/X86InsertPrefetch.cpp llvm/utils/TableGen/X86DisassemblerTables.cpp Removed: diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h index 631665e3fc52e..7b99cc96b149b 100644 --- a/llvm/include/llvm/IR/InstrTypes.h +++ b/llvm/include/llvm/IR/InstrTypes.h @@ -802,8 +802,8 @@ class CmpInst : public Instruction { void setPredicate(Predicate P) { setSubclassData(P); } static bool isFPPredicate(Predicate P) { -assert(FIRST_FCMP_PREDICATE == 0 && - "FIRST_FCMP_PREDICATE is required to be 0"); +static_assert(FIRST_FCMP_PREDICATE == 0, + "FIRST_FCMP_PREDICATE is required to be 0"); return P <= LAST_FCMP_PREDICATE; } diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp index b0d772b6ff212..a16a458168d42 100644 --- a/llvm/lib/Object/XCOFFObjectFile.cpp +++ b/llvm/lib/Object/XCOFFObjectFile.cpp @@ -655,7 +655,8 @@ XCOFFObjectFile::relocations(const XCOFFSectionHeader32 &Sec) const { uint32_t NumRelocEntries = NumRelocEntriesOrErr.get(); - assert(sizeof(XCOFFRelocation32) == XCOFF::RelocationSerializationSize32); + static_assert( + sizeof(XCOFFRelocation32) == XCOFF::RelocationSerializationSize32, ""); auto RelocationOrErr = getObject(Data, reinterpret_cast(RelocAddr), NumRelocEntries * sizeof(XCOFFRelocation32)); diff --git a/llvm/lib/Support/SHA1.cpp b/llvm/lib/Support/SHA1.cpp index 417b13fea05a4..5dce44af9ecd8 100644 --- a/llvm/lib/Support/SHA1.cpp +++ b/llvm/lib/Support/SHA1.cpp @@ -225,7 +225,7 @@ void SHA1::update(ArrayRef Data) { // Fast buffer filling for large inputs. while (Data.size() >= BLOCK_LENGTH) { assert(InternalState.BufferOffset == 0); -assert(BLOCK_LENGTH % 4 == 0); +static_assert(BLOCK_LENGTH % 4 == 0, ""); constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4; for (size_t I = 0; I < BLOCK_LENGTH_32; ++I) InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]); diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index 4a4aad02938a9..8061c6c509e08 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -1015,7 +1015,8 @@ MCOperand AMDGPUDisassembler::decodeSrcOp(const OpWidthTy Width, unsigned Val) c : getVgprClassId(Width), Val - VGPR_MIN); } if (Val <= SGPR_MAX) { -assert(SGPR_MIN == 0); // "SGPR_MIN <= Val" is always true and causes compilation warning. +// "SGPR_MIN <= Val" is always true and causes compilation warning. +static_assert(SGPR_MIN == 0, ""); return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN); } @@ -1052,7 +1053,8 @@ MCOperand AMDGPUDisassembler::decodeDstOp(const OpWidthTy Width, unsigned Val) c assert(Width == OPW256 || Width == OPW512); if (Val <= SGPR_MAX) { -assert(SGPR_MIN == 0); // "SGPR_MIN <= Val" is always true and causes compilation warning. +// "SGPR_MIN <= Val" is always true and causes compilation warning. +static_assert(SGPR_MIN == 0, ""); return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN); } diff --git a/llvm/lib/Target/X86/X86InsertPrefetch.cpp b/llvm/lib/Target/X86/X86InsertPrefetch.cpp index 53925bbfd72fe..004e6fa5ebf4e 100644 --- a/llvm/lib/Target/X86/X86InsertPrefetch.cpp +++ b/llvm/lib/Target/X86/X86InsertPrefetch.cpp @@ -214,10 +214,10 @@ bool X86InsertPrefetch::runOnMachineFunction(MachineFunction &MF) { MF.CreateMachineInstr(Desc, Current->getDebugLoc(), true); MachineInstrBuilder MIB(MF, PFetch); -assert(X86::AddrBaseReg == 0 && X86::AddrScaleAmt == 1 && - X86::AddrIndexReg == 2 && X86::AddrDisp == 3 && - X86::AddrSegmentReg == 4 && - "Unexpected change in X86 operand offset order."); +static_assert(X86::AddrBaseReg == 0 && X86::AddrScaleAmt == 1 && + X86::AddrIndexReg == 2 && X86::AddrDisp == 3 && + X86::AddrSegmentReg == 4, + "Unexpected change in X86 operand offset order."); // This assu
[llvm-branch-commits] [llvm] 2f1ffa9 - [llvm] Forward-declare ICFLoopSafetyInfo (NFC)
Author: Kazu Hirata Date: 2021-01-23T10:56:30-08:00 New Revision: 2f1ffa94d74d03417b60caa8706f84d42ee66e22 URL: https://github.com/llvm/llvm-project/commit/2f1ffa94d74d03417b60caa8706f84d42ee66e22 DIFF: https://github.com/llvm/llvm-project/commit/2f1ffa94d74d03417b60caa8706f84d42ee66e22.diff LOG: [llvm] Forward-declare ICFLoopSafetyInfo (NFC) LoopUtils.h needs ICFLoopSafetyInfo but relies on a forward declaration of ICFLoopSafetyInfo in IVDescriptors.h. This patch adds a forward declaration right in LoopUtils.h. While we are at it, this patch removes the one in IVDescriptors.h, where it is unnecessary. Added: Modified: llvm/include/llvm/Analysis/IVDescriptors.h llvm/include/llvm/Transforms/Utils/LoopUtils.h Removed: diff --git a/llvm/include/llvm/Analysis/IVDescriptors.h b/llvm/include/llvm/Analysis/IVDescriptors.h index 6bb6c4cae0a2..28546110ba04 100644 --- a/llvm/include/llvm/Analysis/IVDescriptors.h +++ b/llvm/include/llvm/Analysis/IVDescriptors.h @@ -32,7 +32,6 @@ class PredicatedScalarEvolution; class ScalarEvolution; class SCEV; class DominatorTree; -class ICFLoopSafetyInfo; /// These are the kinds of recurrences that we support. enum class RecurKind { diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h index 940747b5b2ea..951660bbab28 100644 --- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h +++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h @@ -27,6 +27,7 @@ class AliasSet; class AliasSetTracker; class BasicBlock; class BlockFrequencyInfo; +class ICFLoopSafetyInfo; class IRBuilderBase; class Loop; class LoopInfo; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] cc7a238 - [Target] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-23T10:56:31-08:00 New Revision: cc7a23828657f35f706343982cf96bb6583d4d73 URL: https://github.com/llvm/llvm-project/commit/cc7a23828657f35f706343982cf96bb6583d4d73 DIFF: https://github.com/llvm/llvm-project/commit/cc7a23828657f35f706343982cf96bb6583d4d73.diff LOG: [Target] Use llvm::append_range (NFC) Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp llvm/lib/Target/ARM/ARMParallelDSP.cpp llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp llvm/lib/Target/Hexagon/RDFDeadCode.cpp llvm/lib/Target/PowerPC/PPCCTRLoops.cpp llvm/lib/Target/X86/X86PartialReduction.cpp llvm/lib/Target/X86/X86WinEHState.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp index 4fca8bec7423..51af25050950 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp @@ -81,8 +81,7 @@ recursivelyVisitUsers(GlobalValue &GV, continue; } -for (User *UU : U->users()) - Stack.push_back(UU); +append_range(Stack, U->users()); } } diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 2ce1ac51c018..e959c5f0f8d3 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -6208,12 +6208,10 @@ SDValue SITargetLowering::lowerImage(SDValue Op, SmallVector Ops; if (BaseOpcode->Store || BaseOpcode->Atomic) Ops.push_back(VData); // vdata - if (UseNSA) { -for (const SDValue &Addr : VAddrs) - Ops.push_back(Addr); - } else { + if (UseNSA) +append_range(Ops, VAddrs); + else Ops.push_back(VAddr); - } Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex)); if (BaseOpcode->Sampler) Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex)); diff --git a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp index 18ab7d7cd555..9570680ad9cb 100644 --- a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp @@ -177,10 +177,8 @@ class PhiIncomingAnalysis { } } - if (Divergent && PDT.dominates(&DefBlock, MBB)) { -for (MachineBasicBlock *Succ : MBB->successors()) - Stack.push_back(Succ); - } + if (Divergent && PDT.dominates(&DefBlock, MBB)) +append_range(Stack, MBB->successors()); } while (!Stack.empty()) { @@ -189,8 +187,7 @@ class PhiIncomingAnalysis { continue; ReachableOrdered.push_back(MBB); - for (MachineBasicBlock *Succ : MBB->successors()) -Stack.push_back(Succ); + append_range(Stack, MBB->successors()); } for (MachineBasicBlock *MBB : ReachableOrdered) { diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index f6f8597f3a69..397979b4ab1e 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -3556,8 +3556,7 @@ static bool allUsersAreInFunction(const Value *V, const Function *F) { while (!Worklist.empty()) { auto *U = Worklist.pop_back_val(); if (isa(U)) { - for (auto *UU : U->users()) -Worklist.push_back(UU); + append_range(Worklist, U->users()); continue; } @@ -19126,8 +19125,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, Int8Ptr)); - for (auto S : Shuffles) -Ops.push_back(S); + append_range(Ops, Shuffles); Ops.push_back(Builder.getInt32(SI->getAlignment())); Builder.CreateCall(VstNFunc, Ops); } else { @@ -19143,8 +19141,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, EltPtrTy)); - for (auto S : Shuffles) -Ops.push_back(S); + append_range(Ops, Shuffles); for (unsigned F = 0; F < Factor; F++) { Ops.push_back(Builder.getInt32(F)); Builder.CreateCall(VstNFunc, Ops); diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp index 2b53f57a7f09..61a924078f29 100644 --- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp +++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp @@ -143,8 +143,7 @@ namespace { // Insert exit blocks. SmallVector ExitBlocks; ML.getExitBlocks(ExitBlocks); - for (auto *MBB : ExitBlocks) -Order.push_back(MBB); + append_range(Order, ExitBlocks);
[llvm-branch-commits] [llvm] 1238378 - [llvm] Use pop_back_val (NFC)
Author: Kazu Hirata Date: 2021-01-23T10:56:33-08:00 New Revision: 1238378f185069f0a988ef7ffe68966eb99b1170 URL: https://github.com/llvm/llvm-project/commit/1238378f185069f0a988ef7ffe68966eb99b1170 DIFF: https://github.com/llvm/llvm-project/commit/1238378f185069f0a988ef7ffe68966eb99b1170.diff LOG: [llvm] Use pop_back_val (NFC) Added: Modified: llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp llvm/lib/Transforms/Scalar/NewGVN.cpp llvm/lib/Transforms/Scalar/Reassociate.cpp llvm/lib/Transforms/Scalar/SCCP.cpp llvm/lib/Transforms/Utils/FixIrreducible.cpp llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Removed: diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index b12f53032fae..3f290f2f087b 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -913,8 +913,7 @@ struct AllocaUseVisitor : PtrUseVisitor { // StoreAliases contains aliases of the memory location stored into. SmallVector StoreAliases = {AI}; while (!StoreAliases.empty()) { -Instruction *I = StoreAliases.back(); -StoreAliases.pop_back(); +Instruction *I = StoreAliases.pop_back_val(); for (User *U : I->users()) { // If we are loading from the memory location, we are creating an // alias of the original pointer. @@ -2005,8 +2004,7 @@ static void sinkSpillUsesAfterCoroBegin(Function &F, } // Recursively collect users before coro.begin. while (!Worklist.empty()) { -auto *Def = Worklist.back(); -Worklist.pop_back(); +auto *Def = Worklist.pop_back_val(); for (User *U : Def->users()) { auto Inst = cast(U); if (Dom.dominates(CoroBegin, Inst)) diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 877515910dcf..7998a1ae5c6e 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -824,8 +824,7 @@ static bool canPaddingBeAccessed(Argument *arg) { // sanely. SmallVector WorkList(arg->users()); while (!WorkList.empty()) { -Value *V = WorkList.back(); -WorkList.pop_back(); +Value *V = WorkList.pop_back_val(); if (isa(V) || isa(V)) { if (PtrValues.insert(V).second) llvm::append_range(WorkList, V->users()); diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 118cbbbd418d..5dec9b542076 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -507,8 +507,7 @@ void Formula::canonicalize(const Loop &L) { // Keep the invariant sum in BaseRegs and one of the variant sum in ScaledReg. if (!ScaledReg) { -ScaledReg = BaseRegs.back(); -BaseRegs.pop_back(); +ScaledReg = BaseRegs.pop_back_val(); Scale = 1; } diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 812922c49cfa..8e251ca940a3 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -531,8 +531,7 @@ class LowerMatrixIntrinsics { // list. LLVM_DEBUG(dbgs() << "Forward-propagate shapes:\n"); while (!WorkList.empty()) { - Instruction *Inst = WorkList.back(); - WorkList.pop_back(); + Instruction *Inst = WorkList.pop_back_val(); // New entry, set the value and insert operands bool Propagate = false; @@ -602,8 +601,7 @@ class LowerMatrixIntrinsics { // worklist. LLVM_DEBUG(dbgs() << "Backward-propagate shapes:\n"); while (!WorkList.empty()) { - Value *V = WorkList.back(); - WorkList.pop_back(); + Value *V = WorkList.pop_back_val(); size_t BeforeProcessingV = WorkList.size(); if (!isa(V)) diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 13afd3b72bea..281d47c8625f 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -2876,8 +2876,7 @@ void NewGVN::cleanupTables() { } while (!TempInst.empty()) { -auto *I = TempInst.back(); -TempInst.pop_back(); +auto *I = TempInst.pop_back_val(); I->deleteValue(); } diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 04e7a59c0d0c..dffeb7cc227b 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -1128,8 +1128,7 @@ static Value *EmitAddTreeOfValue
[llvm-branch-commits] [llvm] e4847a7 - Revert "[Target] Use llvm::append_range (NFC)"
Author: Kazu Hirata Date: 2021-01-23T11:25:27-08:00 New Revision: e4847a7fcf777eedc748d2476323726960ab29b7 URL: https://github.com/llvm/llvm-project/commit/e4847a7fcf777eedc748d2476323726960ab29b7 DIFF: https://github.com/llvm/llvm-project/commit/e4847a7fcf777eedc748d2476323726960ab29b7.diff LOG: Revert "[Target] Use llvm::append_range (NFC)" This reverts commit cc7a23828657f35f706343982cf96bb6583d4d73. The X86WinEHState.cpp hunk seems to break certain builds. Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp llvm/lib/Target/ARM/ARMParallelDSP.cpp llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp llvm/lib/Target/Hexagon/RDFDeadCode.cpp llvm/lib/Target/PowerPC/PPCCTRLoops.cpp llvm/lib/Target/X86/X86PartialReduction.cpp llvm/lib/Target/X86/X86WinEHState.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp index 51af25050950..4fca8bec7423 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp @@ -81,7 +81,8 @@ recursivelyVisitUsers(GlobalValue &GV, continue; } -append_range(Stack, U->users()); +for (User *UU : U->users()) + Stack.push_back(UU); } } diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index e959c5f0f8d3..2ce1ac51c018 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -6208,10 +6208,12 @@ SDValue SITargetLowering::lowerImage(SDValue Op, SmallVector Ops; if (BaseOpcode->Store || BaseOpcode->Atomic) Ops.push_back(VData); // vdata - if (UseNSA) -append_range(Ops, VAddrs); - else + if (UseNSA) { +for (const SDValue &Addr : VAddrs) + Ops.push_back(Addr); + } else { Ops.push_back(VAddr); + } Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex)); if (BaseOpcode->Sampler) Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex)); diff --git a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp index 9570680ad9cb..18ab7d7cd555 100644 --- a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp @@ -177,8 +177,10 @@ class PhiIncomingAnalysis { } } - if (Divergent && PDT.dominates(&DefBlock, MBB)) -append_range(Stack, MBB->successors()); + if (Divergent && PDT.dominates(&DefBlock, MBB)) { +for (MachineBasicBlock *Succ : MBB->successors()) + Stack.push_back(Succ); + } } while (!Stack.empty()) { @@ -187,7 +189,8 @@ class PhiIncomingAnalysis { continue; ReachableOrdered.push_back(MBB); - append_range(Stack, MBB->successors()); + for (MachineBasicBlock *Succ : MBB->successors()) +Stack.push_back(Succ); } for (MachineBasicBlock *MBB : ReachableOrdered) { diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 397979b4ab1e..f6f8597f3a69 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -3556,7 +3556,8 @@ static bool allUsersAreInFunction(const Value *V, const Function *F) { while (!Worklist.empty()) { auto *U = Worklist.pop_back_val(); if (isa(U)) { - append_range(Worklist, U->users()); + for (auto *UU : U->users()) +Worklist.push_back(UU); continue; } @@ -19125,7 +19126,8 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, Int8Ptr)); - append_range(Ops, Shuffles); + for (auto S : Shuffles) +Ops.push_back(S); Ops.push_back(Builder.getInt32(SI->getAlignment())); Builder.CreateCall(VstNFunc, Ops); } else { @@ -19141,7 +19143,8 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, EltPtrTy)); - append_range(Ops, Shuffles); + for (auto S : Shuffles) +Ops.push_back(S); for (unsigned F = 0; F < Factor; F++) { Ops.push_back(Builder.getInt32(F)); Builder.CreateCall(VstNFunc, Ops); diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp index 61a924078f29..2b53f57a7f09 100644 --- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp +++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp @@ -143,7 +143,8 @@ namespace { // Insert exit blocks. SmallVector ExitBlocks; ML.getEx
[llvm-branch-commits] [llvm] d44ca0c - [CodeGen] Forward-declare TargetMachine (NFC)
Author: Kazu Hirata Date: 2021-01-24T12:18:54-08:00 New Revision: d44ca0cf2f64dab1da309f70f841ce3d2ffb527c URL: https://github.com/llvm/llvm-project/commit/d44ca0cf2f64dab1da309f70f841ce3d2ffb527c DIFF: https://github.com/llvm/llvm-project/commit/d44ca0cf2f64dab1da309f70f841ce3d2ffb527c.diff LOG: [CodeGen] Forward-declare TargetMachine (NFC) InstrEmitter.h needs TargetMachine but relies on a forward declaration of TargetMachine in MachineOperand.h. This patch adds a forward declaration right in InstrEmitter.h. While we are at it, this patch removes the one in MachineOperand.h, where it is unnecessary. Added: Modified: llvm/include/llvm/CodeGen/MachineOperand.h llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h Removed: diff --git a/llvm/include/llvm/CodeGen/MachineOperand.h b/llvm/include/llvm/CodeGen/MachineOperand.h index b7e89cf4b133..b12351b8a702 100644 --- a/llvm/include/llvm/CodeGen/MachineOperand.h +++ b/llvm/include/llvm/CodeGen/MachineOperand.h @@ -33,7 +33,6 @@ class MachineRegisterInfo; class MCCFIInstruction; class MDNode; class ModuleSlotTracker; -class TargetMachine; class TargetIntrinsicInfo; class TargetRegisterInfo; class hash_code; diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h index d969cb65c5b6..09658b8143fe 100644 --- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h +++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h @@ -26,6 +26,7 @@ class MCInstrDesc; class SDDbgLabel; class SDDbgValue; class TargetLowering; +class TargetMachine; class LLVM_LIBRARY_VISIBILITY InstrEmitter { MachineFunction *MF; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 0544441 - [Target] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-24T12:18:56-08:00 New Revision: 05177b1e6563a67e950a238084f082ece16f URL: https://github.com/llvm/llvm-project/commit/05177b1e6563a67e950a238084f082ece16f DIFF: https://github.com/llvm/llvm-project/commit/05177b1e6563a67e950a238084f082ece16f.diff LOG: [Target] Use llvm::append_range (NFC) Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp llvm/lib/Target/ARM/ARMParallelDSP.cpp llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp llvm/lib/Target/Hexagon/RDFDeadCode.cpp llvm/lib/Target/PowerPC/PPCCTRLoops.cpp llvm/lib/Target/X86/X86PartialReduction.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp index 4fca8bec7423..51af25050950 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp @@ -81,8 +81,7 @@ recursivelyVisitUsers(GlobalValue &GV, continue; } -for (User *UU : U->users()) - Stack.push_back(UU); +append_range(Stack, U->users()); } } diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 2ce1ac51c018..e959c5f0f8d3 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -6208,12 +6208,10 @@ SDValue SITargetLowering::lowerImage(SDValue Op, SmallVector Ops; if (BaseOpcode->Store || BaseOpcode->Atomic) Ops.push_back(VData); // vdata - if (UseNSA) { -for (const SDValue &Addr : VAddrs) - Ops.push_back(Addr); - } else { + if (UseNSA) +append_range(Ops, VAddrs); + else Ops.push_back(VAddr); - } Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex)); if (BaseOpcode->Sampler) Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex)); diff --git a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp index 18ab7d7cd555..9570680ad9cb 100644 --- a/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp @@ -177,10 +177,8 @@ class PhiIncomingAnalysis { } } - if (Divergent && PDT.dominates(&DefBlock, MBB)) { -for (MachineBasicBlock *Succ : MBB->successors()) - Stack.push_back(Succ); - } + if (Divergent && PDT.dominates(&DefBlock, MBB)) +append_range(Stack, MBB->successors()); } while (!Stack.empty()) { @@ -189,8 +187,7 @@ class PhiIncomingAnalysis { continue; ReachableOrdered.push_back(MBB); - for (MachineBasicBlock *Succ : MBB->successors()) -Stack.push_back(Succ); + append_range(Stack, MBB->successors()); } for (MachineBasicBlock *MBB : ReachableOrdered) { diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index f6f8597f3a69..397979b4ab1e 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -3556,8 +3556,7 @@ static bool allUsersAreInFunction(const Value *V, const Function *F) { while (!Worklist.empty()) { auto *U = Worklist.pop_back_val(); if (isa(U)) { - for (auto *UU : U->users()) -Worklist.push_back(UU); + append_range(Worklist, U->users()); continue; } @@ -19126,8 +19125,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, Int8Ptr)); - for (auto S : Shuffles) -Ops.push_back(S); + append_range(Ops, Shuffles); Ops.push_back(Builder.getInt32(SI->getAlignment())); Builder.CreateCall(VstNFunc, Ops); } else { @@ -19143,8 +19141,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI, SmallVector Ops; Ops.push_back(Builder.CreateBitCast(BaseAddr, EltPtrTy)); - for (auto S : Shuffles) -Ops.push_back(S); + append_range(Ops, Shuffles); for (unsigned F = 0; F < Factor; F++) { Ops.push_back(Builder.getInt32(F)); Builder.CreateCall(VstNFunc, Ops); diff --git a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp index 2b53f57a7f09..61a924078f29 100644 --- a/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp +++ b/llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp @@ -143,8 +143,7 @@ namespace { // Insert exit blocks. SmallVector ExitBlocks; ML.getExitBlocks(ExitBlocks); - for (auto *MBB : ExitBlocks) -Order.push_back(MBB); + append_range(Order, ExitBlocks); // Then add the loop body. S
[llvm-branch-commits] [llvm] 16baad8 - [llvm] Use pop_back_val (NFC)
Author: Kazu Hirata Date: 2021-01-24T12:18:57-08:00 New Revision: 16baad8f4e02aea19224da0d397b2f72980b15da URL: https://github.com/llvm/llvm-project/commit/16baad8f4e02aea19224da0d397b2f72980b15da DIFF: https://github.com/llvm/llvm-project/commit/16baad8f4e02aea19224da0d397b2f72980b15da.diff LOG: [llvm] Use pop_back_val (NFC) Added: Modified: llvm/include/llvm/Analysis/RegionInfoImpl.h llvm/include/llvm/Analysis/SparsePropagation.h llvm/lib/Analysis/DivergenceAnalysis.cpp llvm/lib/Analysis/IVDescriptors.cpp llvm/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/DWARFLinker/DWARFLinker.cpp llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/TableGen/Record.cpp llvm/lib/Target/ARM/A15SDOptimizer.cpp llvm/lib/Target/ARM/ARMFrameLowering.cpp llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp llvm/lib/Target/PowerPC/PPCISelLowering.cpp Removed: diff --git a/llvm/include/llvm/Analysis/RegionInfoImpl.h b/llvm/include/llvm/Analysis/RegionInfoImpl.h index d28aee72dda5..b694effb2229 100644 --- a/llvm/include/llvm/Analysis/RegionInfoImpl.h +++ b/llvm/include/llvm/Analysis/RegionInfoImpl.h @@ -886,8 +886,7 @@ typename Tr::RegionT *RegionInfoBase::getCommonRegion(RegionT *A, template typename Tr::RegionT * RegionInfoBase::getCommonRegion(SmallVectorImpl &Regions) const { - RegionT *ret = Regions.back(); - Regions.pop_back(); + RegionT *ret = Regions.pop_back_val(); for (RegionT *R : Regions) ret = getCommonRegion(ret, R); diff --git a/llvm/include/llvm/Analysis/SparsePropagation.h b/llvm/include/llvm/Analysis/SparsePropagation.h index fac92e4a25a4..81a2533152de 100644 --- a/llvm/include/llvm/Analysis/SparsePropagation.h +++ b/llvm/include/llvm/Analysis/SparsePropagation.h @@ -485,8 +485,7 @@ void SparseSolver::Solve() { // Process the basic block work list. while (!BBWorkList.empty()) { - BasicBlock *BB = BBWorkList.back(); - BBWorkList.pop_back(); + BasicBlock *BB = BBWorkList.pop_back_val(); LLVM_DEBUG(dbgs() << "\nPopped off BBWL: " << *BB); diff --git a/llvm/lib/Analysis/DivergenceAnalysis.cpp b/llvm/lib/Analysis/DivergenceAnalysis.cpp index 7bd25de43ffb..287c13278014 100644 --- a/llvm/lib/Analysis/DivergenceAnalysis.cpp +++ b/llvm/lib/Analysis/DivergenceAnalysis.cpp @@ -209,8 +209,7 @@ void DivergenceAnalysis::analyzeLoopExitDivergence(const BasicBlock &DivExit, Visited.insert(&DivExit); do { -auto *UserBlock = TaintStack.back(); -TaintStack.pop_back(); +auto *UserBlock = TaintStack.pop_back_val(); // don't spread divergence beyond the region if (!inRegion(*UserBlock)) diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp index a11faac093db..7f311d8f9a2b 100644 --- a/llvm/lib/Analysis/IVDescriptors.cpp +++ b/llvm/lib/Analysis/IVDescriptors.cpp @@ -273,8 +273,7 @@ bool RecurrenceDescriptor::AddReductionVar(PHINode *Phi, RecurKind Kind, // * An instruction type other than PHI or the reduction operation. // * A PHI in the header other than the initial PHI. while (!Worklist.empty()) { -Instruction *Cur = Worklist.back(); -Worklist.pop_back(); +Instruction *Cur = Worklist.pop_back_val(); // No Users. // If the instruction has no users then this is a broken chain and can't be diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 4e7a16efea4c..895936d47175 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -766,8 +766,7 @@ MemoryDependenceResults::getNonLocalCallDependency(CallBase *QueryCall) { // Iterate while we still have blocks to update. while (!DirtyBlocks.empty()) { -BasicBlock *DirtyBB = DirtyBlocks.back(); -DirtyBlocks.pop_back(); +BasicBlock *DirtyBB = DirtyBlocks.pop_back_val(); // Already processed this block? if (!Visited.insert(DirtyBB).second) diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 28493dd070da..f2800201e871 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2933,8 +2933,7 @@ Error BitcodeReader::parseUseLists() { if (RecordLength < 3) // Records should have at least an ID and two indexes. return error("Invalid record"); - unsigned ID = Record.back(); - Record.pop_back(); + unsigned ID = Record.pop_back_val(); Value *V; if (IsBB) { diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 72640af
[llvm-branch-commits] [llvm] 12fc9ca - [llvm] Remove redundant string initialization (NFC)
Author: Kazu Hirata Date: 2021-01-12T21:43:46-08:00 New Revision: 12fc9ca3a4037a26d4bc0ac98213c846ad96e51b URL: https://github.com/llvm/llvm-project/commit/12fc9ca3a4037a26d4bc0ac98213c846ad96e51b DIFF: https://github.com/llvm/llvm-project/commit/12fc9ca3a4037a26d4bc0ac98213c846ad96e51b.diff LOG: [llvm] Remove redundant string initialization (NFC) Identified with readability-redundant-string-init. Added: Modified: llvm/include/llvm/LTO/Config.h llvm/lib/Analysis/CallPrinter.cpp llvm/lib/Analysis/ConstraintSystem.cpp llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp llvm/lib/Target/Mips/MipsRegisterBankInfo.h llvm/lib/Transforms/IPO/Attributor.cpp llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp llvm/tools/llvm-ifs/llvm-ifs.cpp llvm/tools/llvm-objdump/MachODump.cpp llvm/utils/TableGen/CodeGenDAGPatterns.cpp llvm/utils/TableGen/CodeGenInstruction.cpp llvm/utils/TableGen/CodeGenMapTable.cpp llvm/utils/TableGen/GlobalISelEmitter.cpp llvm/utils/TableGen/RISCVCompressInstEmitter.cpp Removed: diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index c4bf370fa3dd..1a7595d75404 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -114,10 +114,10 @@ struct Config { std::string SplitDwarfOutput; /// Optimization remarks file path. - std::string RemarksFilename = ""; + std::string RemarksFilename; /// Optimization remarks pass filter. - std::string RemarksPasses = ""; + std::string RemarksPasses; /// Whether to emit optimization remarks with hotness informations. bool RemarksWithHotness = false; @@ -138,7 +138,7 @@ struct Config { llvm::Optional RemarksHotnessThreshold = 0; /// The format used for serializing remarks (default: YAML). - std::string RemarksFormat = ""; + std::string RemarksFormat; /// Whether to emit the pass manager debuggging informations. bool DebugPassManager = false; diff --git a/llvm/lib/Analysis/CallPrinter.cpp b/llvm/lib/Analysis/CallPrinter.cpp index c3922d556023..872a91ad7cbf 100644 --- a/llvm/lib/Analysis/CallPrinter.cpp +++ b/llvm/lib/Analysis/CallPrinter.cpp @@ -196,7 +196,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { Function *F = Node->getFunction(); if (F == nullptr) return ""; -std::string attrs = ""; +std::string attrs; if (ShowHeatColors) { uint64_t freq = CGInfo->getFreq(F); std::string color = getHeatColor(freq, CGInfo->getMaxFreq()); diff --git a/llvm/lib/Analysis/ConstraintSystem.cpp b/llvm/lib/Analysis/ConstraintSystem.cpp index 1d582802f8e7..9739c6af5769 100644 --- a/llvm/lib/Analysis/ConstraintSystem.cpp +++ b/llvm/lib/Analysis/ConstraintSystem.cpp @@ -116,7 +116,7 @@ void ConstraintSystem::dump(ArrayRef Names) const { for (unsigned I = 1, S = Row.size(); I < S; ++I) { if (Row[I] == 0) continue; - std::string Coefficient = ""; + std::string Coefficient; if (Row[I] != 1) Coefficient = std::to_string(Row[I]) + " * "; Parts.push_back(Coefficient + Names[I - 1]); diff --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp index f32278d07052..25fae5487187 100644 --- a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -41,7 +41,7 @@ static cl::opt cl::desc("Record GlobalISel rule coverage files of this " "prefix if instrumentation was generated")); #else -static const std::string CoveragePrefix = ""; +static const std::string CoveragePrefix; #endif char InstructionSelect::ID = 0; diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 7bc5c98b89bc..32e8393a88e5 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -917,7 +917,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock( } unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_EXECINSTR; - std::string GroupName = ""; + std::string GroupName; if (F.hasComdat()) { Flags |= ELF::SHF_GROUP; GroupName = F.getComdat()->getName().str(); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index e5e512672daa..2fbe707ce8df 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -352,7 +352,7 @@ class RuntimeDyldCheckerExprEval { RemainingExpr = RemainingExpr.substr(1).ltrim();
[llvm-branch-commits] [llvm] 2c2d489 - [CodeGen] Remove unused function isRegLiveInExitBlocks (NFC)
Author: Kazu Hirata Date: 2021-01-12T21:43:48-08:00 New Revision: 2c2d489b78c43072b65f3d8c88c91def4c69f320 URL: https://github.com/llvm/llvm-project/commit/2c2d489b78c43072b65f3d8c88c91def4c69f320 DIFF: https://github.com/llvm/llvm-project/commit/2c2d489b78c43072b65f3d8c88c91def4c69f320.diff LOG: [CodeGen] Remove unused function isRegLiveInExitBlocks (NFC) The last use was removed on Jan 17, 2020 in commit 42350cd893a9cf6c199b17441dc2ba526c7cca71. Added: Modified: llvm/include/llvm/CodeGen/MachineLoopUtils.h llvm/lib/CodeGen/MachineLoopUtils.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/MachineLoopUtils.h b/llvm/include/llvm/CodeGen/MachineLoopUtils.h index 2cb0134ca848..ec0b3529c0d6 100644 --- a/llvm/include/llvm/CodeGen/MachineLoopUtils.h +++ b/llvm/include/llvm/CodeGen/MachineLoopUtils.h @@ -37,10 +37,6 @@ MachineBasicBlock *PeelSingleBlockLoop(LoopPeelDirection Direction, MachineRegisterInfo &MRI, const TargetInstrInfo *TII); -/// Return true if PhysReg is live outside the loop, i.e. determine if it -/// is live in the loop exit blocks, and false otherwise. -bool isRegLiveInExitBlocks(MachineLoop *Loop, int PhysReg); - } // namespace llvm #endif // LLVM_LIB_CODEGEN_MACHINELOOPUTILS_H diff --git a/llvm/lib/CodeGen/MachineLoopUtils.cpp b/llvm/lib/CodeGen/MachineLoopUtils.cpp index 2295e1ca6d4e..fdcc8472f1c2 100644 --- a/llvm/lib/CodeGen/MachineLoopUtils.cpp +++ b/llvm/lib/CodeGen/MachineLoopUtils.cpp @@ -130,14 +130,3 @@ MachineBasicBlock *llvm::PeelSingleBlockLoop(LoopPeelDirection Direction, return NewBB; } - -bool llvm::isRegLiveInExitBlocks(MachineLoop *Loop, int PhysReg) { - SmallVector ExitBlocks; - Loop->getExitBlocks(ExitBlocks); - - for (auto *MBB : ExitBlocks) -if (MBB->isLiveIn(PhysReg)) - return true; - - return false; -} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8a20e2b - [llvm] Use Optional::getValueOr (NFC)
Author: Kazu Hirata Date: 2021-01-12T21:43:50-08:00 New Revision: 8a20e2b3d3e149f9e40dc34673fce7953d985c24 URL: https://github.com/llvm/llvm-project/commit/8a20e2b3d3e149f9e40dc34673fce7953d985c24 DIFF: https://github.com/llvm/llvm-project/commit/8a20e2b3d3e149f9e40dc34673fce7953d985c24.diff LOG: [llvm] Use Optional::getValueOr (NFC) Added: Modified: llvm/lib/Analysis/InlineAdvisor.cpp llvm/lib/Target/ARC/ARCTargetMachine.cpp llvm/lib/Target/AVR/AVRTargetMachine.cpp llvm/lib/Target/BPF/BPFTargetMachine.cpp llvm/lib/Target/CSKY/CSKYTargetMachine.cpp llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp llvm/lib/Target/Lanai/LanaiTargetMachine.cpp llvm/lib/Target/Sparc/SparcTargetMachine.cpp llvm/lib/Target/VE/VETargetMachine.cpp llvm/lib/Target/XCore/XCoreTargetMachine.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/utils/TableGen/GlobalISelEmitter.cpp Removed: diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp index c427230404e6..342a9e757ac6 100644 --- a/llvm/lib/Analysis/InlineAdvisor.cpp +++ b/llvm/lib/Analysis/InlineAdvisor.cpp @@ -100,8 +100,7 @@ llvm::Optional static getDefaultInlineAdvice( GetBFI, PSI, RemarksEnabled ? &ORE : nullptr); }; return llvm::shouldInline(CB, GetInlineCost, ORE, -Params.EnableDeferral.hasValue() && -Params.EnableDeferral.getValue()); +Params.EnableDeferral.getValueOr(false)); } std::unique_ptr DefaultInlineAdvisor::getAdvice(CallBase &CB) { diff --git a/llvm/lib/Target/ARC/ARCTargetMachine.cpp b/llvm/lib/Target/ARC/ARCTargetMachine.cpp index 4a5b6fd4d5bf..b8c8949e18dd 100644 --- a/llvm/lib/Target/ARC/ARCTargetMachine.cpp +++ b/llvm/lib/Target/ARC/ARCTargetMachine.cpp @@ -21,9 +21,7 @@ using namespace llvm; static Reloc::Model getRelocModel(Optional RM) { - if (!RM.hasValue()) -return Reloc::Static; - return *RM; + return RM.getValueOr(Reloc::Static); } /// ARCTargetMachine ctor - Create an ILP32 architecture model diff --git a/llvm/lib/Target/AVR/AVRTargetMachine.cpp b/llvm/lib/Target/AVR/AVRTargetMachine.cpp index 0c7136e6f77e..0fa8623e2fb7 100644 --- a/llvm/lib/Target/AVR/AVRTargetMachine.cpp +++ b/llvm/lib/Target/AVR/AVRTargetMachine.cpp @@ -37,7 +37,7 @@ static StringRef getCPU(StringRef CPU) { } static Reloc::Model getEffectiveRelocModel(Optional RM) { - return RM.hasValue() ? *RM : Reloc::Static; + return RM.getValueOr(Reloc::Static); } AVRTargetMachine::AVRTargetMachine(const Target &T, const Triple &TT, diff --git a/llvm/lib/Target/BPF/BPFTargetMachine.cpp b/llvm/lib/Target/BPF/BPFTargetMachine.cpp index c35a3192282f..c0244b9f2c74 100644 --- a/llvm/lib/Target/BPF/BPFTargetMachine.cpp +++ b/llvm/lib/Target/BPF/BPFTargetMachine.cpp @@ -57,9 +57,7 @@ static std::string computeDataLayout(const Triple &TT) { } static Reloc::Model getEffectiveRelocModel(Optional RM) { - if (!RM.hasValue()) -return Reloc::PIC_; - return *RM; + return RM.getValueOr(Reloc::PIC_); } BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT, diff --git a/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp b/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp index 3e4e1b083f7a..1c13796e84b6 100644 --- a/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp +++ b/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp @@ -44,7 +44,7 @@ CSKYTargetMachine::CSKYTargetMachine(const Target &T, const Triple &TT, Optional CM, CodeGenOpt::Level OL, bool JIT) : LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options, -!RM.hasValue() ? Reloc::Static : *RM, +RM.getValueOr(Reloc::Static), getEffectiveCodeModel(CM, CodeModel::Small), OL), TLOF(std::make_unique()) { initAsmInfo(); diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp index ba0f45fe09f7..9195bb3dc725 100644 --- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp @@ -187,9 +187,7 @@ namespace llvm { } // end namespace llvm; static Reloc::Model getEffectiveRelocModel(Optional RM) { - if (!RM.hasValue()) -return Reloc::Static; - return *RM; + return RM.getValueOr(Reloc::Static); } extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonTarget() { diff --git a/llvm/lib/Target/Lanai/LanaiTargetMachine.cpp b/llvm/lib/Target/Lanai/LanaiTargetMachine.cpp index 69387119f1f4..a31f59214ec7 100644 --- a/llvm/lib/Target/Lanai/LanaiTargetMachine.cpp +++ b/llvm/lib/Target/Lanai/LanaiTargetMachine.cpp @@ -48,9 +48,7 @@ static std::string computeDataLayout() { } static Relo
[llvm-branch-commits] [clang-tools-extra] fb98a1b - Fix the warnings on unused variables (NFC)
Author: Kazu Hirata Date: 2021-01-13T13:32:40-08:00 New Revision: fb98a1be43645c87fff089c4cc9555ca2400268c URL: https://github.com/llvm/llvm-project/commit/fb98a1be43645c87fff089c4cc9555ca2400268c DIFF: https://github.com/llvm/llvm-project/commit/fb98a1be43645c87fff089c4cc9555ca2400268c.diff LOG: Fix the warnings on unused variables (NFC) Added: Modified: clang-tools-extra/clangd/AST.cpp lld/MachO/InputSection.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp Removed: diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp index 8af4cbb19a3d..aecaf7e6b8f7 100644 --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -116,6 +116,7 @@ getQualification(ASTContext &Context, const DeclContext *DestContext, if (auto *TD = llvm::dyn_cast(CurContext)) { // There can't be any more tag parents after hitting a namespace. assert(!ReachedNS); + (void)ReachedNS; NNS = NestedNameSpecifier::Create(Context, nullptr, false, TD->getTypeForDecl()); } else { diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp index 4cb322a058f9..9287d49dae3c 100644 --- a/lld/MachO/InputSection.cpp +++ b/lld/MachO/InputSection.cpp @@ -50,7 +50,7 @@ void InputSection::writeTo(uint8_t *buf) { // relative to the start of the thread-local data memory area, which // is initialized via copying all the TLV data sections (which are all // contiguous). -if (auto *defined = dyn_cast(referentSym)) +if (isa(referentSym)) referentVA -= firstTLVDataSection->addr; } } else if (auto *referentIsec = r.referent.dyn_cast()) { diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 4823eea4154f..84b78fce3f44 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1538,6 +1538,7 @@ static void rewritePHIs(BasicBlock &BB) { // CleanupPad with a CatchSwitch predecessor: therefore this is an // unwind destination that needs to be handle specially. assert(CS->getUnwindDest() == &BB); +(void)CS; rewritePHIsForCleanupPad(&BB, CleanupPad); return; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5c1c39e - [llvm] Use *Set::contains (NFC)
Author: Kazu Hirata Date: 2021-01-13T19:14:41-08:00 New Revision: 5c1c39e8d808d7d08a2c3c5ed192d543a55f685c URL: https://github.com/llvm/llvm-project/commit/5c1c39e8d808d7d08a2c3c5ed192d543a55f685c DIFF: https://github.com/llvm/llvm-project/commit/5c1c39e8d808d7d08a2c3c5ed192d543a55f685c.diff LOG: [llvm] Use *Set::contains (NFC) Added: Modified: llvm/include/llvm/ADT/DepthFirstIterator.h llvm/include/llvm/Analysis/DivergenceAnalysis.h llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h llvm/lib/Analysis/IRSimilarityIdentifier.cpp llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/ExecutionEngine/MCJIT/MCJIT.h llvm/lib/Transforms/IPO/IROutliner.cpp Removed: diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h index 11967f5eefcc..5bfea28332b2 100644 --- a/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -198,7 +198,7 @@ class df_iterator // nodes that a depth first iteration did not find: ie unreachable nodes. // bool nodeVisited(NodeRef Node) const { -return this->Visited.count(Node) != 0; +return this->Visited.contains(Node); } /// getPathLength - Return the length of the path from the entry node to the diff --git a/llvm/include/llvm/Analysis/DivergenceAnalysis.h b/llvm/include/llvm/Analysis/DivergenceAnalysis.h index 8a32bfbcc758..2e4ae65d0981 100644 --- a/llvm/include/llvm/Analysis/DivergenceAnalysis.h +++ b/llvm/include/llvm/Analysis/DivergenceAnalysis.h @@ -118,7 +118,7 @@ class DivergenceAnalysis { /// /// (see markBlockJoinDivergent). bool isJoinDivergent(const BasicBlock &Block) const { -return DivergentJoinBlocks.find(&Block) != DivergentJoinBlocks.end(); +return DivergentJoinBlocks.contains(&Block); } private: diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h index 7e5a723991d4..2f80b4373b46 100644 --- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h +++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h @@ -339,7 +339,7 @@ class LoopVectorizationLegality { /// Returns true if vector representation of the instruction \p I /// requires mask. - bool isMaskRequired(const Instruction *I) { return (MaskedOp.count(I) != 0); } + bool isMaskRequired(const Instruction *I) { return MaskedOp.contains(I); } unsigned getNumStores() const { return LAI->getNumStores(); } unsigned getNumLoads() const { return LAI->getNumLoads(); } diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp index 60b4f427e189..d8403abc3027 100644 --- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp +++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp @@ -402,7 +402,7 @@ static bool checkNumberingAndReplaceCommutative( DenseSet NewSet; for (unsigned &Curr : ValueMappingIt->second) // If we can find the value in the mapping, we add it to the new set. - if (TargetValueNumbers.find(Curr) != TargetValueNumbers.end()) + if (TargetValueNumbers.contains(Curr)) NewSet.insert(Curr); // If we could not find a Value, return 0. diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7e4ee3bd..24bc7fe7e0ad 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1928,7 +1928,7 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) { auto AddToWorklist = [&](unsigned CurIdx, SDNode *Op, unsigned OpNumber) { // If this is an Op, we can remove the op from the list. Remark any // search associated with it as from the current OpNumber. -if (SeenOps.count(Op) != 0) { +if (SeenOps.contains(Op)) { Changed = true; DidPruneOps = true; unsigned OrigOpNumber = 0; diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h index 83b64b5171c0..52e7eda90310 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h @@ -102,22 +102,22 @@ class MCJIT : public ExecutionEngine { } bool hasModuleBeenAddedButNotLoaded(Module *M) { - return AddedModules.count(M) != 0; + return AddedModules.contains(M); } bool hasModuleBeenLoaded(Module *M) { // If the module is in either the "loaded" or "finalized" sections it // has been loaded. - return (LoadedModules.count(M) != 0 ) || (FinalizedModules.count(M) != 0); + return LoadedModules.contains(M) || FinalizedModules.contains(M); } bool hasModuleBeenFinalized(Module *M) { - return FinalizedModules.count(M) != 0; + return FinalizedModules.contains(M); } bool ownsModule(
[llvm-branch-commits] [llvm] 125ea20 - [llvm] Use llvm::stable_sort (NFC)
Author: Kazu Hirata Date: 2021-01-13T19:14:43-08:00 New Revision: 125ea20d55c554fbe14eb1f6cff7d44a720a51f5 URL: https://github.com/llvm/llvm-project/commit/125ea20d55c554fbe14eb1f6cff7d44a720a51f5 DIFF: https://github.com/llvm/llvm-project/commit/125ea20d55c554fbe14eb1f6cff7d44a720a51f5.diff LOG: [llvm] Use llvm::stable_sort (NFC) Added: Modified: llvm/lib/CodeGen/SafeStackLayout.cpp llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp llvm/lib/Transforms/IPO/IROutliner.cpp llvm/lib/Transforms/Scalar/SROA.cpp llvm/utils/TableGen/DAGISelEmitter.cpp llvm/utils/TableGen/GlobalISelEmitter.cpp llvm/utils/TableGen/RegisterInfoEmitter.cpp llvm/utils/TableGen/SearchableTableEmitter.cpp Removed: diff --git a/llvm/lib/CodeGen/SafeStackLayout.cpp b/llvm/lib/CodeGen/SafeStackLayout.cpp index f333e5046ec6..5bd4f4d60d73 100644 --- a/llvm/lib/CodeGen/SafeStackLayout.cpp +++ b/llvm/lib/CodeGen/SafeStackLayout.cpp @@ -140,10 +140,10 @@ void StackLayout::computeLayout() { // Sort objects by size (largest first) to reduce fragmentation. if (StackObjects.size() > 2) -std::stable_sort(StackObjects.begin() + 1, StackObjects.end(), - [](const StackObject &a, const StackObject &b) { - return a.Size > b.Size; - }); +llvm::stable_sort(drop_begin(StackObjects, 1), + [](const StackObject &a, const StackObject &b) { +return a.Size > b.Size; + }); for (auto &Obj : StackObjects) layoutObject(Obj); diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp index 2788b86181e2..8a44ba32606e 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp @@ -326,7 +326,7 @@ bool HexagonShuffler::ValidResourceUsage(HexagonPacketSummary const &Summary) { } // Verify the CVI slot subscriptions. - std::stable_sort(begin(), end(), HexagonInstr::lessCVI); + llvm::stable_sort(*this, HexagonInstr::lessCVI); // create vector of hvx instructions to check HVXInstsT hvxInsts; hvxInsts.clear(); @@ -609,8 +609,7 @@ llvm::Optional HexagonShuffler::tryAuction(HexagonPacketSummary const &Summary) const { HexagonPacket PacketResult = Packet; HexagonUnitAuction AuctionCore(Summary.ReservedSlotMask); - std::stable_sort(PacketResult.begin(), PacketResult.end(), - HexagonInstr::lessCore); + llvm::stable_sort(PacketResult, HexagonInstr::lessCore); const bool ValidSlots = llvm::all_of(insts(PacketResult), [&AuctionCore](HexagonInstr const &I) { diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp index da9ac99ff802..281b182b8022 100644 --- a/llvm/lib/Transforms/IPO/IROutliner.cpp +++ b/llvm/lib/Transforms/IPO/IROutliner.cpp @@ -554,7 +554,7 @@ static void getCodeExtractorArguments( // Sort the GVNs, since we now have constants included in the \ref InputGVNs // we need to make sure they are in a deterministic order. - stable_sort(InputGVNs.begin(), InputGVNs.end()); + stable_sort(InputGVNs); } /// Look over the inputs and map each input argument to an argument in the diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 0805cb52db7b..1a0180a77afb 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1076,7 +1076,7 @@ AllocaSlices::AllocaSlices(const DataLayout &DL, AllocaInst &AI) // Sort the uses. This arranges for the offsets to be in ascending order, // and the sizes to be in descending order. - std::stable_sort(Slices.begin(), Slices.end()); + llvm::stable_sort(Slices); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index 1652281b5193..32ed0bf98743 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -159,8 +159,7 @@ void DAGISelEmitter::run(raw_ostream &OS) { // We want to process the matches in order of minimal cost. Sort the patterns // so the least cost one is at the start. - std::stable_sort(Patterns.begin(), Patterns.end(), - PatternSortingPredicate(CGP)); + llvm::stable_sort(Patterns, PatternSortingPredicate(CGP)); // Convert each variant of each pattern into a Matcher. Records.startTimer("Convert to matchers"); diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index e18de6ebf9e0..a303753d53c7 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -5480,15 +5480,13 @@ GlobalISelEmitter::buildMatchTable(MutableArrayRef Rules,
[llvm-branch-commits] [llvm] 4c1617d - [llvm] Use std::any_of (NFC)
Author: Kazu Hirata Date: 2021-01-13T19:14:44-08:00 New Revision: 4c1617dac8fa13a8eac9cc4ac13a8f1fb3da512e URL: https://github.com/llvm/llvm-project/commit/4c1617dac8fa13a8eac9cc4ac13a8f1fb3da512e DIFF: https://github.com/llvm/llvm-project/commit/4c1617dac8fa13a8eac9cc4ac13a8f1fb3da512e.diff LOG: [llvm] Use std::any_of (NFC) Added: Modified: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp llvm/tools/obj2yaml/elf2yaml.cpp Removed: diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index ab5bb88759e5..888d3c113c91 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -1281,10 +1281,9 @@ static bool areCFlagsAccessedBetweenInstrs( return true; // From must be above To. - assert(std::find_if(++To.getReverse(), To->getParent()->rend(), - [From](MachineInstr &MI) { -return MI.getIterator() == From; - }) != To->getParent()->rend()); + assert(std::any_of( + ++To.getReverse(), To->getParent()->rend(), + [From](MachineInstr &MI) { return MI.getIterator() == From; })); // We iterate backward starting at \p To until we hit \p From. for (const MachineInstr &Instr : diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp index 3c7f6dd8319d..494aa5b17b13 100644 --- a/llvm/tools/obj2yaml/elf2yaml.cpp +++ b/llvm/tools/obj2yaml/elf2yaml.cpp @@ -187,7 +187,7 @@ bool ELFDumper::shouldPrintSection(const ELFYAML::Section &S, if (S.Type == ELF::SHT_NULL && (&SHdr == &Sections[0])) { const uint8_t *Begin = reinterpret_cast(&SHdr); const uint8_t *End = Begin + sizeof(Elf_Shdr); -return std::find_if(Begin, End, [](uint8_t V) { return V != 0; }) != End; +return std::any_of(Begin, End, [](uint8_t V) { return V != 0; }); } // Normally we use "DWARF:" to describe contents of DWARF sections. Sometimes ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 9bcc0d1 - [CodeGen, Transforms] Use llvm::sort (NFC)
Author: Kazu Hirata Date: 2021-01-14T20:30:31-08:00 New Revision: 9bcc0d1040ddd63b7f82e309c0d5feb4e0c9005e URL: https://github.com/llvm/llvm-project/commit/9bcc0d1040ddd63b7f82e309c0d5feb4e0c9005e DIFF: https://github.com/llvm/llvm-project/commit/9bcc0d1040ddd63b7f82e309c0d5feb4e0c9005e.diff LOG: [CodeGen, Transforms] Use llvm::sort (NFC) Added: Modified: llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp llvm/lib/CodeGen/RDFLiveness.cpp llvm/lib/CodeGen/RegAllocFast.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp llvm/lib/Transforms/Scalar/ConstraintElimination.cpp llvm/lib/Transforms/Scalar/NewGVN.cpp Removed: diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp index 86b804774696..1c9131edab83 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp @@ -242,7 +242,7 @@ void DbgValueHistoryMap::trimLocationRanges( if (ReferenceCount[i] <= 0 && HistoryMapEntries[i].isClobber()) ToRemove.push_back(i); -std::sort(ToRemove.begin(), ToRemove.end()); +llvm::sort(ToRemove); // Build an offset map so we can update the EndIndex of the remaining // entries. diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 34a494cef9c5..1171e4b9519d 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -301,7 +301,7 @@ class FrameIndexesCache { void sortRegisters(SmallVectorImpl &Regs) { if (!FixupSCSExtendSlotSize) return; -llvm::sort(Regs.begin(), Regs.end(), [&](Register &A, Register &B) { +llvm::sort(Regs, [&](Register &A, Register &B) { return getRegisterSize(TRI, A) > getRegisterSize(TRI, B); }); } diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index b6f46daf8bba..18ffe8ba0669 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -2282,7 +2282,7 @@ InstrRefBasedLDV::mlocJoin(MachineBasicBlock &MBB, auto Cmp = [&](const MachineBasicBlock *A, const MachineBasicBlock *B) { return BBToOrder.find(A)->second < BBToOrder.find(B)->second; }; - llvm::sort(BlockOrders.begin(), BlockOrders.end(), Cmp); + llvm::sort(BlockOrders, Cmp); // Skip entry block. if (BlockOrders.size() == 0) @@ -2649,7 +2649,7 @@ std::tuple InstrRefBasedLDV::vlocJoin( return BBToOrder[A] < BBToOrder[B]; }; - llvm::sort(BlockOrders.begin(), BlockOrders.end(), Cmp); + llvm::sort(BlockOrders, Cmp); unsigned CurBlockRPONum = BBToOrder[&MBB]; @@ -2991,7 +2991,7 @@ void InstrRefBasedLDV::vlocDataflow( for (auto *MBB : BlocksToExplore) BlockOrders.push_back(const_cast(MBB)); - llvm::sort(BlockOrders.begin(), BlockOrders.end(), Cmp); + llvm::sort(BlockOrders, Cmp); unsigned NumBlocks = BlockOrders.size(); // Allocate some vectors for storing the live ins and live outs. Large. @@ -3170,7 +3170,7 @@ void InstrRefBasedLDV::emitLocations( // in the middle. for (auto &P : TTracker->Transfers) { // Sort them according to appearance order. -llvm::sort(P.Insts.begin(), P.Insts.end(), OrderDbgValues); +llvm::sort(P.Insts, OrderDbgValues); // Insert either before or after the designated point... if (P.MBB) { MachineBasicBlock &MBB = *P.MBB; diff --git a/llvm/lib/CodeGen/RDFLiveness.cpp b/llvm/lib/CodeGen/RDFLiveness.cpp index a8b254061b41..76bf0c280970 100644 --- a/llvm/lib/CodeGen/RDFLiveness.cpp +++ b/llvm/lib/CodeGen/RDFLiveness.cpp @@ -230,11 +230,11 @@ NodeList Liveness::getAllReachingDefs(RegisterRef RefRR, TmpBB.push_back(Bucket.first); if (Bucket.second.size() > 2) GetOrder(*Bucket.first); -llvm::sort(Bucket.second.begin(), Bucket.second.end(), Precedes); +llvm::sort(Bucket.second, Precedes); } // Sort the blocks with respect to dominance. - llvm::sort(TmpBB.begin(), TmpBB.end(), + llvm::sort(TmpBB, [this](auto A, auto B) { return MDT.properlyDominates(A, B); }); std::vector TmpInst; diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index d6c5e11fd0c5..6e548d4a93c8 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -1157,8 +1157,7 @@ void RegAllocFast::allocateInstruction(MachineInstr &MI) { } } -llvm::sort(DefOperandIndexes.begin(), DefOperandIndexes.end(), - [&](uint16_t I0
[llvm-branch-commits] [llvm] 2efcbe2 - [llvm] Use llvm::drop_begin (NFC)
Author: Kazu Hirata Date: 2021-01-14T20:30:33-08:00 New Revision: 2efcbe24a75b2a9ff6d59d242f560dca96e5f7e0 URL: https://github.com/llvm/llvm-project/commit/2efcbe24a75b2a9ff6d59d242f560dca96e5f7e0 DIFF: https://github.com/llvm/llvm-project/commit/2efcbe24a75b2a9ff6d59d242f560dca96e5f7e0.diff LOG: [llvm] Use llvm::drop_begin (NFC) Added: Modified: llvm/lib/Analysis/LazyCallGraph.cpp llvm/lib/Analysis/ModuleSummaryAnalysis.cpp llvm/lib/Analysis/VFABIDemangling.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/X86/X86MCInstLower.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp llvm/tools/llvm-xray/xray-stacks.cpp Removed: diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp index ef16f94822a3..f2c85a69f125 100644 --- a/llvm/lib/Analysis/LazyCallGraph.cpp +++ b/llvm/lib/Analysis/LazyCallGraph.cpp @@ -866,7 +866,7 @@ LazyCallGraph::RefSCC::switchInternalEdgeToRef(Node &SourceN, Node &TargetN) { PendingSCCStack.clear(); while (!DFSStack.empty()) OldSCC.Nodes.push_back(DFSStack.pop_back_val().first); -for (Node &N : make_range(OldSCC.begin() + OldSize, OldSCC.end())) { +for (Node &N : drop_begin(OldSCC, OldSize)) { N.DFSNumber = N.LowLink = -1; G->SCCMap[&N] = &OldSCC; } diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 7d06aac08619..ed544c284990 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -145,7 +145,7 @@ static void addVCallToSet(DevirtCallSite Call, GlobalValue::GUID Guid, SetVector &ConstVCalls) { std::vector Args; // Start from the second argument to skip the "this" pointer. - for (auto &Arg : make_range(Call.CB.arg_begin() + 1, Call.CB.arg_end())) { + for (auto &Arg : drop_begin(Call.CB.args(), 1)) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) { VCalls.insert({Guid, Call.Offset}); diff --git a/llvm/lib/Analysis/VFABIDemangling.cpp b/llvm/lib/Analysis/VFABIDemangling.cpp index 4cdffa63135f..27b48b310af4 100644 --- a/llvm/lib/Analysis/VFABIDemangling.cpp +++ b/llvm/lib/Analysis/VFABIDemangling.cpp @@ -290,9 +290,9 @@ bool verifyAllVectorsHaveSameWidth(FunctionType *Signature) { assert(VecTys.size() > 1 && "Invalid number of elements."); const ElementCount EC = VecTys[0]->getElementCount(); - return llvm::all_of( - llvm::make_range(VecTys.begin() + 1, VecTys.end()), - [&EC](VectorType *VTy) { return (EC == VTy->getElementCount()); }); + return llvm::all_of(llvm::drop_begin(VecTys, 1), [&EC](VectorType *VTy) { +return (EC == VTy->getElementCount()); + }); } #endif // NDEBUG diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 564a3d7d9bc8..2c636e1ac04f 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -661,7 +661,7 @@ bool CodeGenPrepare::eliminateFallThrough(Function &F) { // Use a temporary array to avoid iterator being invalidated when // deleting blocks. SmallVector Blocks; - for (auto &Block : llvm::make_range(std::next(F.begin()), F.end())) + for (auto &Block : llvm::drop_begin(F, 1)) Blocks.push_back(&Block); SmallSet Preds; @@ -747,7 +747,7 @@ bool CodeGenPrepare::eliminateMostlyEmptyBlocks(Function &F) { // as we remove them. // Note that this intentionally skips the entry block. SmallVector Blocks; - for (auto &Block : llvm::make_range(std::next(F.begin()), F.end())) + for (auto &Block : llvm::drop_begin(F, 1)) Blocks.push_back(&Block); for (auto &Block : Blocks) { diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp index f9f342a07f6d..fa12fe1da448 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp @@ -110,7 +110,7 @@ HexagonMCInstrInfo::bundleInstructions(MCInstrInfo const &MCII, iterator_range HexagonMCInstrInfo::bundleInstructions(MCInst const &MCI) { assert(isBundle(MCI)); - return make_range(MCI.begin() + bundleInstructionsOffset, MCI.end()); + return drop_begin(MCI, bundleInstructionsOffset); } size_t HexagonMCInstrInfo::bundleSize(MCInst const &MCI) { diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index c693bef6d325..e348bba2b04c 100644 --- a/llvm/lib/Target/WebAssembly/WebAssembl
[llvm-branch-commits] [llvm] 7dc3575 - [llvm] Remove redundant return and continue statements (NFC)
Author: Kazu Hirata Date: 2021-01-14T20:30:34-08:00 New Revision: 7dc3575ef2dc85d92aa3ad916d0eb73a0aa088c9 URL: https://github.com/llvm/llvm-project/commit/7dc3575ef2dc85d92aa3ad916d0eb73a0aa088c9 DIFF: https://github.com/llvm/llvm-project/commit/7dc3575ef2dc85d92aa3ad916d0eb73a0aa088c9.diff LOG: [llvm] Remove redundant return and continue statements (NFC) Identified with readability-redundant-control-flow. Added: Modified: llvm/include/llvm/CodeGen/LiveRegUnits.h llvm/lib/CodeGen/MachinePipeliner.cpp llvm/lib/Demangle/MicrosoftDemangleNodes.cpp llvm/lib/FileCheck/FileCheck.cpp llvm/lib/IR/AutoUpgrade.cpp llvm/lib/Passes/StandardInstrumentations.cpp llvm/lib/Support/Unix/Path.inc llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp llvm/lib/Target/BPF/BPFISelDAGToDAG.cpp llvm/lib/Target/PowerPC/PPCISelLowering.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp llvm/lib/Target/X86/X86FlagsCopyLowering.cpp llvm/lib/Target/X86/X86IndirectThunks.cpp llvm/lib/TextAPI/MachO/InterfaceFile.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/IPO/AttributorAttributes.cpp llvm/lib/Transforms/IPO/IROutliner.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp llvm/tools/llvm-mca/CodeRegion.cpp llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp llvm/tools/llvm-profgen/ProfiledBinary.cpp llvm/utils/TableGen/X86FoldTablesEmitter.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/LiveRegUnits.h b/llvm/include/llvm/CodeGen/LiveRegUnits.h index e20e04cad35c..39a1ec461ef6 100644 --- a/llvm/include/llvm/CodeGen/LiveRegUnits.h +++ b/llvm/include/llvm/CodeGen/LiveRegUnits.h @@ -67,7 +67,6 @@ class LiveRegUnits { UsedRegUnits.addReg(Reg); } } -return; } /// Initialize and clear the set. diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 9564192761d2..d0fe29f65ede 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1751,7 +1751,6 @@ void SwingSchedulerDAG::checkNodeSets(NodeSetType &NodeSets) { } NodeSets.clear(); LLVM_DEBUG(dbgs() << "Clear recurrence node-sets\n"); - return; } /// Add the nodes that do not belong to a recurrence set into groups diff --git a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp index 9cee975231a2..8b15ffcee778 100644 --- a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -649,5 +649,4 @@ void SpecialTableSymbolNode::output(OutputStream &OS, OutputFlags Flags) const { TargetName->output(OS, Flags); OS << "'}"; } - return; } diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp index c6a5b69e2055..2a213fcfe901 100644 --- a/llvm/lib/FileCheck/FileCheck.cpp +++ b/llvm/lib/FileCheck/FileCheck.cpp @@ -2318,7 +2318,6 @@ bool FileCheckString::CheckNot(const SourceMgr &SM, StringRef Buffer, PrintMatch(false, SM, Prefix, Pat->getLoc(), *Pat, 1, Buffer, Pos, MatchLen, Req, Diags); DirectiveFail = true; -continue; } return DirectiveFail; diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index e863f8e52a26..23e7af6287b6 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -1769,7 +1769,6 @@ void llvm::UpgradeInlineAsmString(std::string *AsmStr) { (Pos = AsmStr->find("# marker")) != std::string::npos) { AsmStr->replace(Pos, 1, ";"); } - return; } /// Upgrade a call to an old intrinsic. All argument and return casting must be diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp index 04ff0af2f804..a8bfe02d4432 100644 --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/llvm/lib/Passes/StandardInstrumentations.cpp @@ -501,7 +501,6 @@ void PrintIRInstrumentation::printBeforePass(StringRef PassID, Any IR) { SmallString<20> Banner = formatv("*** IR Dump Before {0} ***", PassID); unwrapAndPrint(dbgs(), IR, Banner, forcePrintModuleIR()); - return; } void PrintIRInstrumentation::printAfterPass(StringRef PassID, Any IR) { diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 8b1dbdb08a14..77f3f54bd881 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -685,8 +685,6 @@ void expand_tilde(const Twine &path, SmallVectorImpl &dest) {
[llvm-branch-commits] [llvm] a396e2e - [utils] Use llvm::sort (NFC)
Author: Kazu Hirata Date: 2021-01-15T21:00:52-08:00 New Revision: a396e2e088eeab974a5d386df9466757a4bdced0 URL: https://github.com/llvm/llvm-project/commit/a396e2e088eeab974a5d386df9466757a4bdced0 DIFF: https://github.com/llvm/llvm-project/commit/a396e2e088eeab974a5d386df9466757a4bdced0.diff LOG: [utils] Use llvm::sort (NFC) Added: Modified: llvm/utils/FileCheck/FileCheck.cpp llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp llvm/utils/TableGen/GlobalISel/GIMatchDagInstr.cpp Removed: diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index 1721b23ad7b5..be277566620e 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -519,54 +519,54 @@ static void DumpAnnotatedInput(raw_ostream &OS, const FileCheckRequest &Req, OS << "Input was:\n<<\n"; // Sort annotations. - std::sort(Annotations.begin(), Annotations.end(), -[](const InputAnnotation &A, const InputAnnotation &B) { - // 1. Sort annotations in the order of the input lines. - // - // This makes it easier to find relevant annotations while - // iterating input lines in the implementation below. FileCheck - // does not always produce diagnostics in the order of input - // lines due to, for example, CHECK-DAG and CHECK-NOT. - if (A.InputLine != B.InputLine) -return A.InputLine < B.InputLine; - // 2. Sort annotations in the temporal order FileCheck produced - // their associated diagnostics. - // - // This sort offers several benefits: - // - // A. On a single input line, the order of annotations reflects - //the FileCheck logic for processing directives/patterns. - //This can be helpful in understanding cases in which the - //order of the associated directives/patterns in the check - //file or on the command line either (i) does not match the - //temporal order in which FileCheck looks for matches for the - //directives/patterns (due to, for example, CHECK-LABEL, - //CHECK-NOT, or `--implicit-check-not`) or (ii) does match - //that order but does not match the order of those - //diagnostics along an input line (due to, for example, - //CHECK-DAG). - // - //On the other hand, because our presentation format presents - //input lines in order, there's no clear way to offer the - //same benefit across input lines. For consistency, it might - //then seem worthwhile to have annotations on a single line - //also sorted in input order (that is, by input column). - //However, in practice, this appears to be more confusing - //than helpful. Perhaps it's intuitive to expect annotations - //to be listed in the temporal order in which they were - //produced except in cases the presentation format obviously - //and inherently cannot support it (that is, across input - //lines). - // - // B. When diagnostics' annotations are split among multiple - //input lines, the user must track them from one input line - //to the next. One property of the sort chosen here is that - //it facilitates the user in this regard by ensuring the - //following: when comparing any two input lines, a - //diagnostic's annotations are sorted in the same position - //relative to all other diagnostics' annotations. - return A.DiagIndex < B.DiagIndex; -}); + llvm::sort(Annotations, + [](const InputAnnotation &A, const InputAnnotation &B) { + // 1. Sort annotations in the order of the input lines. + // + // This makes it easier to find relevant annotations while + // iterating input lines in the implementation below. FileCheck + // does not always produce diagnostics in the order of input + // lines due to, for example, CHECK-DAG and CHECK-NOT. + if (A.InputLine != B.InputLine) + return A.InputLine < B.InputLine; + // 2. Sort annotations in the temporal order FileCheck produced + // their associated diagnostics. + // + // This sort offers several benefits: + // + // A. On a single input line, the order of annotations reflects + //the FileCheck logic for processing directi
[llvm-branch-commits] [llvm] 4707b21 - [AMDGPU] Use llvm::is_contained (NFC)
Author: Kazu Hirata Date: 2021-01-15T21:00:54-08:00 New Revision: 4707b21298a6daf28b08d9395568ccc94a549711 URL: https://github.com/llvm/llvm-project/commit/4707b21298a6daf28b08d9395568ccc94a549711 DIFF: https://github.com/llvm/llvm-project/commit/4707b21298a6daf28b08d9395568ccc94a549711.diff LOG: [AMDGPU] Use llvm::is_contained (NFC) Added: Modified: llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp b/llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp index 85e402da342b..7635cd39cd2c 100644 --- a/llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp +++ b/llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp @@ -58,12 +58,7 @@ unsigned CFStack::getLoopDepth() { } bool CFStack::branchStackContains(CFStack::StackItem Item) { - for (std::vector::const_iterator I = BranchStack.begin(), - E = BranchStack.end(); I != E; ++I) { -if (*I == Item) - return true; - } - return false; + return llvm::is_contained(BranchStack, Item); } bool CFStack::requiresWorkAroundForInst(unsigned Opcode) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8fd8ff1 - [StringExtras] Rename SubsequentDelim to ListSeparator
Author: Kazu Hirata Date: 2021-01-15T21:00:56-08:00 New Revision: 8fd8ff1f67e4919954162ccf5f0e9b5e9c2d53fb URL: https://github.com/llvm/llvm-project/commit/8fd8ff1f67e4919954162ccf5f0e9b5e9c2d53fb DIFF: https://github.com/llvm/llvm-project/commit/8fd8ff1f67e4919954162ccf5f0e9b5e9c2d53fb.diff LOG: [StringExtras] Rename SubsequentDelim to ListSeparator This patch renames SubsequentDelim to ListSeparator to clarify the purpose of the class. Differential Revision: https://reviews.llvm.org/D94649 Added: Modified: llvm/include/llvm/ADT/StringExtras.h llvm/lib/CodeGen/MachineBasicBlock.cpp llvm/unittests/ADT/StringExtrasTest.cpp Removed: diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index fe5c5967a2cf..10596cf82398 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -470,22 +470,22 @@ inline std::string join_items(Sep Separator, Args &&... Items) { /// list from a loop like so: /// /// \code -/// SubsequentDelim SD; +/// ListSeparator SD; /// for (auto &I : C) /// OS << SD << I.getName(); /// \end -class SubsequentDelim { +class ListSeparator { bool First = true; - StringRef Delim; + StringRef Separator; - public: - SubsequentDelim(StringRef Delim = ", ") : Delim(Delim) {} +public: + ListSeparator(StringRef Separator = ", ") : Separator(Separator) {} operator StringRef() { if (First) { First = false; return {}; } -return Delim; +return Separator; } }; diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index fded4b15e67b..b4187af02975 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -353,9 +353,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; // Don't indent(2), align with previous line attributes. OS << "; predecessors: "; -SubsequentDelim SD; +ListSeparator LS; for (auto *Pred : predecessors()) - OS << SD << printMBBReference(*Pred); + OS << LS << printMBBReference(*Pred); OS << '\n'; HasLineAttributes = true; } @@ -364,9 +364,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; // Print the successors OS.indent(2) << "successors: "; -SubsequentDelim SD; +ListSeparator LS; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { - OS << SD << printMBBReference(**I); + OS << LS << printMBBReference(**I); if (!Probs.empty()) OS << '(' << format("0x%08" PRIx32, getSuccProbability(I).getNumerator()) @@ -375,10 +375,10 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (!Probs.empty() && IsStandalone) { // Print human readable probabilities as comments. OS << "; "; - SubsequentDelim SD; + ListSeparator LS; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { const BranchProbability &BP = getSuccProbability(I); -OS << SD << printMBBReference(**I) << '(' +OS << LS << printMBBReference(**I) << '(' << format("%.2f%%", rint(((double)BP.getNumerator() / BP.getDenominator()) * 100.0 * 100.0) / @@ -395,9 +395,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; OS.indent(2) << "liveins: "; -SubsequentDelim SD; +ListSeparator LS; for (const auto &LI : liveins()) { - OS << SD << printReg(LI.PhysReg, TRI); + OS << LS << printReg(LI.PhysReg, TRI); if (!LI.LaneMask.all()) OS << ":0x" << PrintLaneMask(LI.LaneMask); } diff --git a/llvm/unittests/ADT/StringExtrasTest.cpp b/llvm/unittests/ADT/StringExtrasTest.cpp index 97a5f946a216..afc9a0136b81 100644 --- a/llvm/unittests/ADT/StringExtrasTest.cpp +++ b/llvm/unittests/ADT/StringExtrasTest.cpp @@ -216,16 +216,16 @@ TEST(StringExtras, IToStr) { EXPECT_EQ(std::to_string(MaxInt64), itostr(MaxInt64)); } -TEST(StringExtras, SubsequentDelim) { - SubsequentDelim SD; - StringRef S = SD; +TEST(StringExtras, ListSeparator) { + ListSeparator LS; + StringRef S = LS; EXPECT_EQ(S, ""); - S = SD; + S = LS; EXPECT_EQ(S, ", "); - SubsequentDelim SD2(" "); - S = SD2; + ListSeparator LS2(" "); + S = LS2; EXPECT_EQ(S, ""); - S = SD2; + S = LS2; EXPECT_EQ(S, " "); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ba0fc7e - [StringExtras] Fix comment typos (NFC)
Author: Kazu Hirata Date: 2021-01-16T09:40:51-08:00 New Revision: ba0fc7e1f8d57a7a7dce1a2d604b12e5210dc10f URL: https://github.com/llvm/llvm-project/commit/ba0fc7e1f8d57a7a7dce1a2d604b12e5210dc10f DIFF: https://github.com/llvm/llvm-project/commit/ba0fc7e1f8d57a7a7dce1a2d604b12e5210dc10f.diff LOG: [StringExtras] Fix comment typos (NFC) Added: Modified: llvm/include/llvm/ADT/StringExtras.h Removed: diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index 10596cf82398..68e89508cba9 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -470,9 +470,9 @@ inline std::string join_items(Sep Separator, Args &&... Items) { /// list from a loop like so: /// /// \code -/// ListSeparator SD; +/// ListSeparator LS; /// for (auto &I : C) -/// OS << SD << I.getName(); +/// OS << LS << I.getName(); /// \end class ListSeparator { bool First = true; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 19aacdb - [llvm] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-16T09:40:53-08:00 New Revision: 19aacdb715aea1de56a47b807a555335610a11c2 URL: https://github.com/llvm/llvm-project/commit/19aacdb715aea1de56a47b807a555335610a11c2 DIFF: https://github.com/llvm/llvm-project/commit/19aacdb715aea1de56a47b807a555335610a11c2.diff LOG: [llvm] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/include/llvm/Support/GenericDomTree.h llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/lib/IR/LLVMContextImpl.cpp llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp llvm/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp llvm/lib/Transforms/Utils/CallPromotionUtils.cpp llvm/lib/Transforms/Utils/Debugify.cpp llvm/lib/Transforms/Utils/LCSSA.cpp llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp llvm/lib/Transforms/Vectorize/VPlan.cpp Removed: diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h index 28b2537bc481..18e08dbcd175 100644 --- a/llvm/include/llvm/Support/GenericDomTree.h +++ b/llvm/include/llvm/Support/GenericDomTree.h @@ -839,9 +839,7 @@ class DominatorTreeBase { "NewBB should have a single successor!"); NodeRef NewBBSucc = *GraphT::child_begin(NewBB); -SmallVector PredBlocks; -for (auto Pred : children>(NewBB)) - PredBlocks.push_back(Pred); +SmallVector PredBlocks(children>(NewBB)); assert(!PredBlocks.empty() && "No predblocks?"); diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 8ec23559cc59..2f5c91aafd39 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -3274,8 +3274,7 @@ const SCEV *ScalarEvolution::getUDivExactExpr(const SCEV *LHS, // first element of the mulexpr. if (const auto *LHSCst = dyn_cast(Mul->getOperand(0))) { if (LHSCst == RHSCst) { -SmallVector Operands; -Operands.append(Mul->op_begin() + 1, Mul->op_end()); +SmallVector Operands(drop_begin(Mul->operands(), 1)); return getMulExpr(Operands); } diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 2ef3d9947169..ee781d4aa1dd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2194,7 +2194,7 @@ void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node, if (Node->isStrictFPOpcode()) { EVT RetVT = Node->getValueType(0); -SmallVector Ops(Node->op_begin() + 1, Node->op_end()); +SmallVector Ops(drop_begin(Node->ops(), 1)); TargetLowering::MakeLibCallOptions CallOptions; // FIXME: This doesn't support tail calls. std::pair Tmp = TLI.makeLibCall(DAG, LC, RetVT, diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index d96376356fcf..e998138ec3cb 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -176,7 +176,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) { unsigned Hash = hash_combine_range(N->op_begin() + Offset, N->op_end()); #ifndef NDEBUG { -SmallVector MDs(N->op_begin() + Offset, N->op_end()); +SmallVector MDs(drop_begin(N->operands(), Offset)); unsigned RawHash = calculateHash(MDs); assert(Hash == RawHash && "Expected hash of MDOperand to equal hash of Metadata*"); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp index 3fc57d69b8e8..4fca8bec7423 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp @@ -54,13 +54,10 @@ char AMDGPUAlwaysInline::ID = 0; static void recursivelyVisitUsers(GlobalValue &GV, SmallPtrSetImpl &FuncsToAlwaysInline) { - SmallVector Stack; + SmallVector Stack(GV.users()); SmallPtrSet Visited; - for (User *U : GV.users()) -Stack.push_back(U); - while (!Stack.empty()) { User *U = Stack.pop_back_val(); if (!Visited.insert(U).second) diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp index 2b2142cc6c21..e1ab64c8c37b 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp @@ -2854,7 +2854,7 @@ bool NVPTXDAGToDAGISel::tryTextureIntrinsic(SDNode *N) { } // Copy over operands - SmallVector Ops(N->op_begin() + 1, N->op_end()); + SmallVector Ops(drop_begin(N->ops(), 1)); Ops.push_back(N->getOperand(0)); // Move chain to the back. ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops)); @@ -3363,7 +3363,7 @@ bool NVPTXDAGToDAGISel::trySur
[llvm-branch-commits] [llvm] 2082b10 - [llvm] Use *::empty (NFC)
Author: Kazu Hirata Date: 2021-01-16T09:40:55-08:00 New Revision: 2082b10d100e8dbaffc2ba8f497db5d2ab61beb2 URL: https://github.com/llvm/llvm-project/commit/2082b10d100e8dbaffc2ba8f497db5d2ab61beb2 DIFF: https://github.com/llvm/llvm-project/commit/2082b10d100e8dbaffc2ba8f497db5d2ab61beb2.diff LOG: [llvm] Use *::empty (NFC) Added: Modified: llvm/lib/Analysis/CGSCCPassManager.cpp llvm/lib/CodeGen/BranchFolding.cpp llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp llvm/lib/CodeGen/PHIElimination.cpp llvm/lib/CodeGen/RegisterScavenging.cpp llvm/lib/Object/SymbolSize.cpp llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp llvm/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp llvm/lib/Target/X86/X86CmovConversion.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/Scalar/SROA.cpp llvm/tools/llvm-exegesis/lib/Target.cpp llvm/tools/llvm-readobj/ELFDumper.cpp Removed: diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp index 4aa7a4b2a61e..3230e9036b8e 100644 --- a/llvm/lib/Analysis/CGSCCPassManager.cpp +++ b/llvm/lib/Analysis/CGSCCPassManager.cpp @@ -833,7 +833,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) { using SCC = LazyCallGraph::SCC; - if (NewSCCRange.begin() == NewSCCRange.end()) + if (NewSCCRange.empty()) return C; // Add the current SCC to the worklist as its shape has changed. diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index fd0936ae05e8..fd3f465fb390 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1403,7 +1403,7 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) { LLVM_DEBUG(dbgs() << "\nMerging into block: " << PrevBB << "From MBB: " << *MBB); // Remove redundant DBG_VALUEs first. - if (PrevBB.begin() != PrevBB.end()) { + if (!PrevBB.empty()) { MachineBasicBlock::iterator PrevBBIter = PrevBB.end(); --PrevBBIter; MachineBasicBlock::iterator MBBIter = MBB->begin(); diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 1171e4b9519d..662bd1a3646f 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -434,7 +434,7 @@ class StatepointState { // To insert reload at the end of MBB, insert it before last instruction // and then swap them. -assert(MBB->begin() != MBB->end() && "Empty block"); +assert(!MBB->empty() && "Empty block"); --It; TII.loadRegFromStackSlot(*MBB, It, Reg, FI, RC, &TRI); MachineInstr *Reload = It->getPrevNode(); diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp index c486319f142f..8148b64d8443 100644 --- a/llvm/lib/CodeGen/PHIElimination.cpp +++ b/llvm/lib/CodeGen/PHIElimination.cpp @@ -394,8 +394,7 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB, } LiveInterval &DestLI = LIS->getInterval(DestReg); -assert(DestLI.begin() != DestLI.end() && - "PHIs should have nonempty LiveIntervals."); +assert(!DestLI.empty() && "PHIs should have nonempty LiveIntervals."); if (DestLI.endIndex().isDead()) { // A dead PHI's live range begins and ends at the start of the MBB, but // the lowered copy, which will still be dead, needs to begin and end at diff --git a/llvm/lib/CodeGen/RegisterScavenging.cpp b/llvm/lib/CodeGen/RegisterScavenging.cpp index 93e8e27d12aa..a833895c115d 100644 --- a/llvm/lib/CodeGen/RegisterScavenging.cpp +++ b/llvm/lib/CodeGen/RegisterScavenging.cpp @@ -91,7 +91,7 @@ void RegScavenger::enterBasicBlockEnd(MachineBasicBlock &MBB) { LiveUnits.addLiveOuts(MBB); // Move internal iterator at the last instruction of the block. - if (MBB.begin() != MBB.end()) { + if (!MBB.empty()) { MBBI = std::prev(MBB.end()); Tracking = true; } diff --git a/llvm/lib/Object/SymbolSize.cpp b/llvm/lib/Object/SymbolSize.cpp index 84eed4d169d3..97baabec084b 100644 --- a/llvm/lib/Object/SymbolSize.cpp +++ b/llvm/lib/Object/SymbolSize.cpp @@ -48,7 +48,7 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) { if (const auto *E = dyn_cast(&O)) { auto Syms = E->symbols(); -if (Syms.begin() == Syms.end()) +if (Syms.empty()) Syms = E->getDynamicSymbolIterators(); for (ELFSymbolRef Sym : Syms) Ret.push_back({Sym, Sym.getSize()}); diff --git a/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp b/llvm/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp index 3f76bdd0d680..3530c2b7b717 100644 --- a/llvm/lib/Targ
[llvm-branch-commits] [llvm] 352fcfc - [llvm] Use llvm::sort (NFC)
Author: Kazu Hirata Date: 2021-01-17T10:39:45-08:00 New Revision: 352fcfc69788093b50971a9f5540a61fa0887ce1 URL: https://github.com/llvm/llvm-project/commit/352fcfc69788093b50971a9f5540a61fa0887ce1 DIFF: https://github.com/llvm/llvm-project/commit/352fcfc69788093b50971a9f5540a61fa0887ce1.diff LOG: [llvm] Use llvm::sort (NFC) Added: Modified: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/DWARFLinker/DWARFLinker.cpp llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp llvm/lib/DebugInfo/GSYM/GsymCreator.cpp llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp llvm/lib/FileCheck/FileCheck.cpp llvm/lib/Object/COFFObjectFile.cpp llvm/lib/Support/DebugCounter.cpp llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp llvm/lib/Target/Hexagon/HexagonBlockRanges.cpp llvm/lib/TextAPI/MachO/TextStub.cpp llvm/tools/llvm-cov/CoverageExporterJson.cpp llvm/tools/llvm-cov/CoverageExporterLcov.cpp llvm/tools/llvm-jitlink/llvm-jitlink.cpp Removed: diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 9f62cce028f8..4d886f708cd4 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3830,7 +3830,7 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences( NameVals.push_back(VE.getValueID(RI.getValue())); // Sort the refs for determinism output, the vector returned by FS->refs() has // been initialized from a DenseSet. - llvm::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end()); + llvm::sort(drop_begin(NameVals, SizeBeforeRefs)); if (VTableFuncs.empty()) Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp index a09cbf9c95ea..b57d14bfcf55 100644 --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -2590,7 +2590,7 @@ bool DWARFLinker::link() { std::vector> Sorted; for (auto &E : SizeByObject) Sorted.emplace_back(E.first(), E.second); -llvm::sort(Sorted.begin(), Sorted.end(), [](auto &LHS, auto &RHS) { +llvm::sort(Sorted, [](auto &LHS, auto &RHS) { return LHS.second.Output > RHS.second.Output; }); diff --git a/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp index be8c32d5b294..9bc69abea102 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp @@ -47,10 +47,9 @@ Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const { } std::vector SortedFrames(Frames.begin(), Frames.end()); - std::sort(SortedFrames.begin(), SortedFrames.end(), -[](const FrameData &LHS, const FrameData &RHS) { - return LHS.RvaStart < RHS.RvaStart; -}); + llvm::sort(SortedFrames, [](const FrameData &LHS, const FrameData &RHS) { +return LHS.RvaStart < RHS.RvaStart; + }); if (auto EC = Writer.writeArray(makeArrayRef(SortedFrames))) return EC; return Error::success(); diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp index 7d9b72c6283d..2001478e8047 100644 --- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp +++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp @@ -169,7 +169,7 @@ llvm::Error GsymCreator::finalize(llvm::raw_ostream &OS) { Finalized = true; // Sort function infos so we can emit sorted functions. - llvm::sort(Funcs.begin(), Funcs.end()); + llvm::sort(Funcs); // Don't let the string table indexes change by finalizing in order. StrTab.finalizeInOrder(); diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp index 9017c824098b..fd9a0deb54d6 100644 --- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp @@ -514,11 +514,10 @@ SymbolCache::findLineTable(uint16_t Modi) const { } // Sort EntryList, and add flattened contents to the line table. - std::sort(EntryList.begin(), EntryList.end(), -[](const std::vector &LHS, - const std::vector &RHS) { - return LHS[0].Addr < RHS[0].Addr; -}); + llvm::sort(EntryList, [](const std::vector &LHS, + const std::vector &RHS) { +return LHS[0].Addr < RHS[0].Addr; + }); for (size_t I = 0; I < EntryList.size(); ++I) llvm::append_range(ModuleLineTable, EntryList[I]); diff --git a/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp b/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp index 7240c1ed0ce9..c2fa4466eab6 100644 --- a/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp +++ b/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
[llvm-branch-commits] [llvm] a591261 - [IRBuilder] "Zero"-initialize SmallVector (NFC)
Author: Kazu Hirata Date: 2021-01-17T10:39:47-08:00 New Revision: a59126115e9586dd7fda4bb365ee43682814fc53 URL: https://github.com/llvm/llvm-project/commit/a59126115e9586dd7fda4bb365ee43682814fc53 DIFF: https://github.com/llvm/llvm-project/commit/a59126115e9586dd7fda4bb365ee43682814fc53.diff LOG: [IRBuilder] "Zero"-initialize SmallVector (NFC) Added: Modified: llvm/lib/IR/IRBuilder.cpp Removed: diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp index 7e76a6c2a055..91ca984b755c 100644 --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -1047,9 +1047,7 @@ Value *IRBuilderBase::CreatePreserveArrayAccessIndex( Value *LastIndexV = getInt32(LastIndex); Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0); - SmallVector IdxList; - for (unsigned I = 0; I < Dimension; ++I) -IdxList.push_back(Zero); + SmallVector IdxList(Dimension, Zero); IdxList.push_back(LastIndexV); Type *ResultType = ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 50be8e4 - [TableGen] Drop redundant const from return types (NFC)
Author: Kazu Hirata Date: 2021-01-17T10:39:49-08:00 New Revision: 50be8e447152b8512521e568e4918dec486c25a5 URL: https://github.com/llvm/llvm-project/commit/50be8e447152b8512521e568e4918dec486c25a5 DIFF: https://github.com/llvm/llvm-project/commit/50be8e447152b8512521e568e4918dec486c25a5.diff LOG: [TableGen] Drop redundant const from return types (NFC) Identified with readability-const-return-type. Added: Modified: llvm/utils/TableGen/CodeGenRegisters.cpp llvm/utils/TableGen/CodeGenRegisters.h llvm/utils/TableGen/CodeGenTarget.cpp llvm/utils/TableGen/CodeGenTarget.h llvm/utils/TableGen/DAGISelMatcher.h llvm/utils/TableGen/GlobalISelEmitter.cpp llvm/utils/TableGen/OptParserEmitter.cpp Removed: diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index f520c1dbc5d2..24eac080cc37 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -196,7 +196,7 @@ void CodeGenRegister::buildObjectGraph(CodeGenRegBank &RegBank) { } } -const StringRef CodeGenRegister::getName() const { +StringRef CodeGenRegister::getName() const { assert(TheDef && "no def"); return TheDef->getName(); } diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h index 48cb9fe1a7e6..5228e6518fe5 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -163,7 +163,7 @@ namespace llvm { CodeGenRegister(Record *R, unsigned Enum); -const StringRef getName() const; +StringRef getName() const; // Extract more information from TheDef. This is used to build an object // graph after all CodeGenRegister objects have been created. diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 572851ed8726..8f6d212df5ec 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -260,9 +260,7 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records) CodeGenTarget::~CodeGenTarget() { } -const StringRef CodeGenTarget::getName() const { - return TargetRec->getName(); -} +StringRef CodeGenTarget::getName() const { return TargetRec->getName(); } /// getInstNamespace - Find and return the target machine's instruction /// namespace. The namespace is cached because it is requested multiple times. diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index 1852bac15511..9de9b512f74f 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -68,7 +68,7 @@ class CodeGenTarget { ~CodeGenTarget(); Record *getTargetRecord() const { return TargetRec; } - const StringRef getName() const; + StringRef getName() const; /// getInstNamespace - Return the target-specific instruction namespace. /// diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index 3a920d1d7f22..ff9a0cb335d1 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -706,7 +706,7 @@ class CheckComplexPatMatcher : public Matcher { const ComplexPattern &getPattern() const { return Pattern; } unsigned getMatchNumber() const { return MatchNumber; } - const std::string getName() const { return Name; } + std::string getName() const { return Name; } unsigned getFirstResult() const { return FirstResult; } static bool classof(const Matcher *N) { diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index a303753d53c7..8026a3a102be 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -1582,7 +1582,7 @@ class OperandMatcher : public PredicateListMatcher { AllocatedTemporariesBaseID(AllocatedTemporariesBaseID) {} bool hasSymbolicName() const { return !SymbolicName.empty(); } - const StringRef getSymbolicName() const { return SymbolicName; } + StringRef getSymbolicName() const { return SymbolicName; } void setSymbolicName(StringRef Name) { assert(SymbolicName.empty() && "Operand already has a symbolic name"); SymbolicName = std::string(Name); @@ -2536,7 +2536,7 @@ class CopyRenderer : public OperandRenderer { return R->getKind() == OR_Copy; } - const StringRef getSymbolicName() const { return SymbolicName; } + StringRef getSymbolicName() const { return SymbolicName; } void emitRenderOpcodes(MatchTable &Table, RuleMatcher &Rule) const override { const OperandMatcher &Operand = Rule.getOperandMatcher(SymbolicName); @@ -2603,7 +2603,7 @@ class CopyOrAddZeroRegRenderer : public OperandRenderer { return R->getKind() == OR_CopyOrAddZeroReg; } - const StringRef getSymbolicName() const { return SymbolicName; } + StringRef getSymbolicName() const { return Symbo
[llvm-branch-commits] [llvm] 28ea50f - [llvm] Populate std::vector at construction time (NFC)
Author: Kazu Hirata Date: 2021-01-18T10:16:33-08:00 New Revision: 28ea50f524b56e11b608ca1f768d2981579ebe75 URL: https://github.com/llvm/llvm-project/commit/28ea50f524b56e11b608ca1f768d2981579ebe75 DIFF: https://github.com/llvm/llvm-project/commit/28ea50f524b56e11b608ca1f768d2981579ebe75.diff LOG: [llvm] Populate std::vector at construction time (NFC) Added: Modified: llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/ObjectYAML/MachOEmitter.cpp llvm/lib/ProfileData/SampleProf.cpp Removed: diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp index 0584ef0aadca..eec733c7d7f9 100644 --- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp +++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp @@ -63,8 +63,7 @@ static Error writeVariableSizedInteger(uint64_t Integer, size_t Size, } static void ZeroFillBytes(raw_ostream &OS, size_t Size) { - std::vector FillData; - FillData.insert(FillData.begin(), Size, 0); + std::vector FillData(Size, 0); OS.write(reinterpret_cast(FillData.data()), Size); } diff --git a/llvm/lib/ObjectYAML/MachOEmitter.cpp b/llvm/lib/ObjectYAML/MachOEmitter.cpp index 9eba391032b9..dec9c9f6960b 100644 --- a/llvm/lib/ObjectYAML/MachOEmitter.cpp +++ b/llvm/lib/ObjectYAML/MachOEmitter.cpp @@ -199,14 +199,12 @@ size_t writeLoadCommandData( } void ZeroFillBytes(raw_ostream &OS, size_t Size) { - std::vector FillData; - FillData.insert(FillData.begin(), Size, 0); + std::vector FillData(Size, 0); OS.write(reinterpret_cast(FillData.data()), Size); } void Fill(raw_ostream &OS, size_t Size, uint32_t Data) { - std::vector FillData; - FillData.insert(FillData.begin(), (Size / 4) + 1, Data); + std::vector FillData((Size / 4) + 1, Data); OS.write(reinterpret_cast(FillData.data()), Size); } diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp index 809576c57ffc..d6acc00e1a6f 100644 --- a/llvm/lib/ProfileData/SampleProf.cpp +++ b/llvm/lib/ProfileData/SampleProf.cpp @@ -287,8 +287,7 @@ std::error_code ProfileSymbolList::read(const uint8_t *Data, std::error_code ProfileSymbolList::write(raw_ostream &OS) { // Sort the symbols before output. If doing compression. // It will make the compression much more effective. - std::vector SortedList; - SortedList.insert(SortedList.begin(), Syms.begin(), Syms.end()); + std::vector SortedList(Syms.begin(), Syms.end()); llvm::sort(SortedList); std::string OutputString; @@ -303,8 +302,7 @@ std::error_code ProfileSymbolList::write(raw_ostream &OS) { void ProfileSymbolList::dump(raw_ostream &OS) const { OS << " Dump profile symbol list \n"; - std::vector SortedList; - SortedList.insert(SortedList.begin(), Syms.begin(), Syms.end()); + std::vector SortedList(Syms.begin(), Syms.end()); llvm::sort(SortedList); for (auto &Sym : SortedList) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 23b0ab2 - [llvm] Use the default value of drop_begin (NFC)
Author: Kazu Hirata Date: 2021-01-18T10:16:36-08:00 New Revision: 23b0ab2acb424e3e74722c0183e5c5ac84e6ea4c URL: https://github.com/llvm/llvm-project/commit/23b0ab2acb424e3e74722c0183e5c5ac84e6ea4c DIFF: https://github.com/llvm/llvm-project/commit/23b0ab2acb424e3e74722c0183e5c5ac84e6ea4c.diff LOG: [llvm] Use the default value of drop_begin (NFC) Added: Modified: llvm/lib/Analysis/LoopInfo.cpp llvm/lib/Analysis/ModuleSummaryAnalysis.cpp llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Analysis/VFABIDemangling.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/SafeStackLayout.cpp llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp llvm/lib/Target/X86/X86MCInstLower.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp llvm/lib/Transforms/Scalar/LoopInterchange.cpp llvm/tools/llvm-xray/xray-stacks.cpp Removed: diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index e925e0d20647..a85869b16333 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -567,7 +567,7 @@ bool Loop::isAnnotatedParallel() const { SmallPtrSet ParallelAccessGroups; // For scalable 'contains' check. if (ParallelAccesses) { -for (const MDOperand &MD : drop_begin(ParallelAccesses->operands(), 1)) { +for (const MDOperand &MD : drop_begin(ParallelAccesses->operands())) { MDNode *AccGroup = cast(MD.get()); assert(isValidAsAccessGroup(AccGroup) && "List item must be an access group"); diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index ed544c284990..5f7746eeed15 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -145,7 +145,7 @@ static void addVCallToSet(DevirtCallSite Call, GlobalValue::GUID Guid, SetVector &ConstVCalls) { std::vector Args; // Start from the second argument to skip the "this" pointer. - for (auto &Arg : drop_begin(Call.CB.args(), 1)) { + for (auto &Arg : drop_begin(Call.CB.args())) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) { VCalls.insert({Guid, Call.Offset}); diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 2f5c91aafd39..f8c297fb3da6 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -3274,7 +3274,7 @@ const SCEV *ScalarEvolution::getUDivExactExpr(const SCEV *LHS, // first element of the mulexpr. if (const auto *LHSCst = dyn_cast(Mul->getOperand(0))) { if (LHSCst == RHSCst) { -SmallVector Operands(drop_begin(Mul->operands(), 1)); +SmallVector Operands(drop_begin(Mul->operands())); return getMulExpr(Operands); } diff --git a/llvm/lib/Analysis/VFABIDemangling.cpp b/llvm/lib/Analysis/VFABIDemangling.cpp index 27b48b310af4..faa46537ad17 100644 --- a/llvm/lib/Analysis/VFABIDemangling.cpp +++ b/llvm/lib/Analysis/VFABIDemangling.cpp @@ -290,7 +290,7 @@ bool verifyAllVectorsHaveSameWidth(FunctionType *Signature) { assert(VecTys.size() > 1 && "Invalid number of elements."); const ElementCount EC = VecTys[0]->getElementCount(); - return llvm::all_of(llvm::drop_begin(VecTys, 1), [&EC](VectorType *VTy) { + return llvm::all_of(llvm::drop_begin(VecTys), [&EC](VectorType *VTy) { return (EC == VTy->getElementCount()); }); } diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 2c636e1ac04f..c2fccab947d6 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -661,7 +661,7 @@ bool CodeGenPrepare::eliminateFallThrough(Function &F) { // Use a temporary array to avoid iterator being invalidated when // deleting blocks. SmallVector Blocks; - for (auto &Block : llvm::drop_begin(F, 1)) + for (auto &Block : llvm::drop_begin(F)) Blocks.push_back(&Block); SmallSet Preds; @@ -747,7 +747,7 @@ bool CodeGenPrepare::eliminateMostlyEmptyBlocks(Function &F) { // as we remove them. // Note that this intentionally skips the entry block. SmallVector Blocks; - for (auto &Block : llvm::drop_begin(F, 1)) + for (auto &Block : llvm::drop_begin(F)) Blocks.push_back(&Block); for (auto &Block : Blocks) { diff --git a/llvm/lib/CodeGen/SafeStackLayout.cpp b/llvm/lib/CodeGen/SafeStackLayout.cpp index 5bd4f4d60d73..5d61b3a146b4 100644 --- a/llvm/lib/CodeGen/SafeStackLayout.cpp +++ b/llvm/lib/CodeGen/SafeStackLayout.cpp @@ -140,7 +140,7 @@ void StackLayout::computeLayout() { // Sort objects by size (largest first) to reduce fragmentation. if
[llvm-branch-commits] [llvm] dc300be - [STLExtras] Add a default value to drop_begin
Author: Kazu Hirata Date: 2021-01-18T10:16:34-08:00 New Revision: dc300beba7a849aac44c39ccc450a575db99bc14 URL: https://github.com/llvm/llvm-project/commit/dc300beba7a849aac44c39ccc450a575db99bc14 DIFF: https://github.com/llvm/llvm-project/commit/dc300beba7a849aac44c39ccc450a575db99bc14.diff LOG: [STLExtras] Add a default value to drop_begin This patch adds the default value of 1 to drop_begin. In the llvm codebase, 70% of calls to drop_begin have 1 as the second argument. The interface similar to with std::next should improve readability. This patch converts a couple of calls to drop_begin as examples. Differential Revision: https://reviews.llvm.org/D94858 Added: Modified: llvm/include/llvm/ADT/STLExtras.h llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/unittests/ADT/STLExtrasTest.cpp Removed: diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index c8c1aff9f2dd..63c7f48a5bd2 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -272,7 +272,7 @@ template bool hasSingleElement(ContainerTy &&C) { /// Return a range covering \p RangeOrContainer with the first N elements /// excluded. -template auto drop_begin(T &&RangeOrContainer, size_t N) { +template auto drop_begin(T &&RangeOrContainer, size_t N = 1) { return make_range(std::next(adl_begin(RangeOrContainer), N), adl_end(RangeOrContainer)); } diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 401fe450ebad..e6575ee2caf2 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -349,7 +349,7 @@ Optional llvm::makeFollowupLoopID( bool Changed = false; if (InheritAllAttrs || InheritSomeAttrs) { -for (const MDOperand &Existing : drop_begin(OrigLoopID->operands(), 1)) { +for (const MDOperand &Existing : drop_begin(OrigLoopID->operands())) { MDNode *Op = cast(Existing.get()); auto InheritThisAttribute = [InheritSomeAttrs, @@ -386,7 +386,7 @@ Optional llvm::makeFollowupLoopID( continue; HasAnyFollowup = true; -for (const MDOperand &Option : drop_begin(FollowupNode->operands(), 1)) { +for (const MDOperand &Option : drop_begin(FollowupNode->operands())) { MDs.push_back(Option.get()); Changed = true; } diff --git a/llvm/unittests/ADT/STLExtrasTest.cpp b/llvm/unittests/ADT/STLExtrasTest.cpp index 01968171b832..862653055417 100644 --- a/llvm/unittests/ADT/STLExtrasTest.cpp +++ b/llvm/unittests/ADT/STLExtrasTest.cpp @@ -400,6 +400,17 @@ TEST(STLExtrasTest, DropBeginTest) { } } +TEST(STLExtrasTest, DropBeginDefaultTest) { + SmallVector vec{0, 1, 2, 3, 4}; + + int i = 1; + for (auto &v : drop_begin(vec)) { +EXPECT_EQ(v, i); +i += 1; + } + EXPECT_EQ(i, 5); +} + TEST(STLExtrasTest, EarlyIncrementTest) { std::list L = {1, 2, 3, 4}; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] fe301f4 - [LoopInfo] Fix a typo in compareLoops
Author: Kazu Hirata Date: 2021-01-18T14:53:22-08:00 New Revision: fe301f474977da0b82548652ef4bbd058542d076 URL: https://github.com/llvm/llvm-project/commit/fe301f474977da0b82548652ef4bbd058542d076 DIFF: https://github.com/llvm/llvm-project/commit/fe301f474977da0b82548652ef4bbd058542d076.diff LOG: [LoopInfo] Fix a typo in compareLoops The code here is checking to see if two sets are identical. OtherBlocksSet should point to OtherL->getBlocksSet() instead. Differential Revision: https://reviews.llvm.org/D94926 Added: Modified: llvm/include/llvm/Analysis/LoopInfoImpl.h Removed: diff --git a/llvm/include/llvm/Analysis/LoopInfoImpl.h b/llvm/include/llvm/Analysis/LoopInfoImpl.h index 0730225c342f..426b349c6b8a 100644 --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -673,7 +673,8 @@ static void compareLoops(const LoopT *L, const LoopT *OtherL, "Mismatched basic blocks in the loops!"); const SmallPtrSetImpl &BlocksSet = L->getBlocksSet(); - const SmallPtrSetImpl &OtherBlocksSet = L->getBlocksSet(); + const SmallPtrSetImpl &OtherBlocksSet = + OtherL->getBlocksSet(); assert(BlocksSet.size() == OtherBlocksSet.size() && llvm::all_of(BlocksSet, [&OtherBlocksSet](const BlockT *BB) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8857202 - [llvm] Use llvm::find (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:14-08:00 New Revision: 885720248921324d28b983248dcc4056fd994a0f URL: https://github.com/llvm/llvm-project/commit/885720248921324d28b983248dcc4056fd994a0f DIFF: https://github.com/llvm/llvm-project/commit/885720248921324d28b983248dcc4056fd994a0f.diff LOG: [llvm] Use llvm::find (NFC) Added: Modified: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/MCA/Stages/InstructionTables.cpp llvm/lib/Support/DynamicLibrary.cpp llvm/lib/Target/Hexagon/HexagonSubtarget.cpp llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp llvm/lib/Transforms/Scalar/GuardWidening.cpp llvm/lib/Transforms/Vectorize/VPlan.h llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp llvm/utils/TableGen/SubtargetEmitter.cpp Removed: diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index ef83df8bdd96..1bee1421cac0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18957,8 +18957,7 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode *N) { // Have we seen this input vector before? // The vectors are expected to be tiny (usually 1 or 2 elements), so using // a map back from SDValues to numbers isn't worth it. -unsigned Idx = std::distance( -VecIn.begin(), std::find(VecIn.begin(), VecIn.end(), ExtractedFromVec)); +unsigned Idx = std::distance(VecIn.begin(), find(VecIn, ExtractedFromVec)); if (Idx == VecIn.size()) VecIn.push_back(ExtractedFromVec); diff --git a/llvm/lib/MCA/Stages/InstructionTables.cpp b/llvm/lib/MCA/Stages/InstructionTables.cpp index a0cdfb89c553..93e368123066 100644 --- a/llvm/lib/MCA/Stages/InstructionTables.cpp +++ b/llvm/lib/MCA/Stages/InstructionTables.cpp @@ -30,8 +30,7 @@ Error InstructionTables::execute(InstRef &IR) { if (!Resource.second.size()) continue; unsigned Cycles = Resource.second.size(); -unsigned Index = std::distance( -Masks.begin(), std::find(Masks.begin(), Masks.end(), Resource.first)); +unsigned Index = std::distance(Masks.begin(), find(Masks, Resource.first)); const MCProcResourceDesc &ProcResource = *SM.getProcResource(Index); unsigned NumUnits = ProcResource.NumUnits; if (!ProcResource.SubUnitsIdxBegin) { diff --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp index d23716016fb2..bdf74623670b 100644 --- a/llvm/lib/Support/DynamicLibrary.cpp +++ b/llvm/lib/Support/DynamicLibrary.cpp @@ -39,9 +39,7 @@ class DynamicLibrary::HandleSet { HandleSet() : Process(nullptr) {} ~HandleSet(); - HandleList::iterator Find(void *Handle) { -return std::find(Handles.begin(), Handles.end(), Handle); - } + HandleList::iterator Find(void *Handle) { return find(Handles, Handle); } bool Contains(void *Handle) { return Handle == Process || Find(Handle) != Handles.end(); diff --git a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp index fed1abb9549b..87b1c43961d7 100644 --- a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp +++ b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp @@ -527,7 +527,7 @@ void HexagonSubtarget::restoreLatency(SUnit *Src, SUnit *Dst) const { // Update the latency of opposite edge too. T.setSUnit(Src); -auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T); +auto F = find(Dst->Preds, T); assert(F != Dst->Preds.end()); F->setLatency(I.getLatency()); } @@ -544,7 +544,7 @@ void HexagonSubtarget::changeLatency(SUnit *Src, SUnit *Dst, unsigned Lat) // Update the latency of opposite edge too. T.setSUnit(Src); -auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T); +auto F = find(Dst->Preds, T); assert(F != Dst->Preds.end()); F->setLatency(Lat); } diff --git a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp index 90cc81beb89d..5cee00c61fc1 100644 --- a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp +++ b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp @@ -206,9 +206,9 @@ static bool splitMBB(BlockSplitInfo &BSI) { NewMBB->splice(NewMBB->end(), ThisMBB, InsertPoint, ThisMBB->end()); NewMBB->transferSuccessors(ThisMBB); if (!ProbOrigTarget.isUnknown()) { -auto MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigTarget); +auto MBBI = find(NewMBB->successors(), OrigTarget); NewMBB->setSuccProbability(MBBI, ProbOrigTarget); -MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigFallThrough); +MBBI = find(NewMBB->successors(), OrigFallThrough); NewMBB->setSuccProbability(MBBI, ProbOrigFallThrough); } diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp index 1735266f0e58..6ce79bdb7076
[llvm-branch-commits] [llvm] 978c754 - [llvm] Use llvm::any_of (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:16-08:00 New Revision: 978c754076e37c7b392240dd121b5b6cb8d1bde2 URL: https://github.com/llvm/llvm-project/commit/978c754076e37c7b392240dd121b5b6cb8d1bde2 DIFF: https://github.com/llvm/llvm-project/commit/978c754076e37c7b392240dd121b5b6cb8d1bde2.diff LOG: [llvm] Use llvm::any_of (NFC) Added: Modified: llvm/lib/Support/CommandLine.cpp llvm/tools/llvm-objcopy/ELF/Object.cpp llvm/utils/TableGen/AsmWriterEmitter.cpp Removed: diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c8578f9ce32c..6d89481bf28a 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1204,7 +1204,7 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, }; // Check for recursive response files. -if (std::any_of(FileStack.begin() + 1, FileStack.end(), IsEquivalent)) { +if (any_of(drop_begin(FileStack), IsEquivalent)) { // This file is recursive, so we leave it in the argument stream and // move on. AllExpanded = false; diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index 2f455d7ecc1e..0ff82f951b62 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -2451,8 +2451,8 @@ template Error ELFWriter::finalize() { if (Obj.sections().size() >= SHN_LORESERVE) { SectionTableRef Sections = Obj.sections(); NeedsLargeIndexes = -std::any_of(Sections.begin() + SHN_LORESERVE, Sections.end(), -[](const SectionBase &Sec) { return Sec.HasSymbol; }); +any_of(drop_begin(Sections, SHN_LORESERVE), + [](const SectionBase &Sec) { return Sec.HasSymbol; }); // TODO: handle case where only one section needs the large index table but // only needs it because the large index table hasn't been removed yet. } diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 3e27bd78b376..a09ea775808c 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -218,12 +218,11 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, // Otherwise, scan to see if all of the other instructions in this command // set share the operand. - if (std::any_of(Idxs.begin()+1, Idxs.end(), - [&](unsigned Idx) { -const AsmWriterInst &OtherInst = Instructions[Idx]; -return OtherInst.Operands.size() == Op || - OtherInst.Operands[Op] != FirstInst.Operands[Op]; - })) + if (any_of(drop_begin(Idxs), [&](unsigned Idx) { +const AsmWriterInst &OtherInst = Instructions[Idx]; +return OtherInst.Operands.size() == Op || + OtherInst.Operands[Op] != FirstInst.Operands[Op]; + })) break; // Okay, everything in this command set has the same next operand. Add it ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b023cde - [llvm] Use llvm::all_of (NFC)
Author: Kazu Hirata Date: 2021-01-19T20:19:17-08:00 New Revision: b023cdeacce3e7029d8a684bfbcb6f1c88dc1017 URL: https://github.com/llvm/llvm-project/commit/b023cdeacce3e7029d8a684bfbcb6f1c88dc1017 DIFF: https://github.com/llvm/llvm-project/commit/b023cdeacce3e7029d8a684bfbcb6f1c88dc1017.diff LOG: [llvm] Use llvm::all_of (NFC) Added: Modified: llvm/lib/Analysis/IRSimilarityIdentifier.cpp llvm/lib/CodeGen/MachineVerifier.cpp llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/lib/Transforms/Scalar/GuardWidening.cpp llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp Removed: diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp index d8403abc3027..25443a667908 100644 --- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp +++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp @@ -124,15 +124,13 @@ bool IRSimilarity::isClose(const IRInstructionData &A, auto ZippedOperands = zip(GEP->indices(), OtherGEP->indices()); -auto ZIt = ZippedOperands.begin(); - // We increment here since we do not care about the first instruction, // we only care about the following operands since they must be the // exact same to be considered similar. -return std::all_of(++ZIt, ZippedOperands.end(), - [](std::tuple R) { - return std::get<0>(R) == std::get<1>(R); - }); +return all_of(drop_begin(ZippedOperands), + [](std::tuple R) { +return std::get<0>(R) == std::get<1>(R); + }); } // If the instructions are functions, we make sure that the function name is diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index 1cfadef251c5..9045019dc1ee 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -1005,16 +1005,15 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) { } case TargetOpcode::G_PHI: { LLT DstTy = MRI->getType(MI->getOperand(0).getReg()); -if (!DstTy.isValid() || -!std::all_of(MI->operands_begin() + 1, MI->operands_end(), - [this, &DstTy](const MachineOperand &MO) { - if (!MO.isReg()) - return true; - LLT Ty = MRI->getType(MO.getReg()); - if (!Ty.isValid() || (Ty != DstTy)) - return false; - return true; - })) +if (!DstTy.isValid() || !all_of(drop_begin(MI->operands()), +[this, &DstTy](const MachineOperand &MO) { + if (!MO.isReg()) +return true; + LLT Ty = MRI->getType(MO.getReg()); + if (!Ty.isValid() || (Ty != DstTy)) +return false; + return true; +})) report("Generic Instruction G_PHI has operands with incompatible/missing " "types", MI); diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1bee1421cac0..f7c6a77b9a03 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -19452,9 +19452,8 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) { return DAG.getUNDEF(VT); // Optimize concat_vectors where all but the first of the vectors are undef. - if (std::all_of(std::next(N->op_begin()), N->op_end(), [](const SDValue &Op) { -return Op.isUndef(); - })) { + if (all_of(drop_begin(N->ops()), + [](const SDValue &Op) { return Op.isUndef(); })) { SDValue In = N->getOperand(0); assert(In.getValueType().isVector() && "Must concat vectors"); @@ -21441,11 +21440,10 @@ SDValue DAGCombiner::SimplifyVBinOp(SDNode *N) { // Make sure all but the first op are undef or constant. auto ConcatWithConstantOrUndef = [](SDValue Concat) { return Concat.getOpcode() == ISD::CONCAT_VECTORS && - std::all_of(std::next(Concat->op_begin()), Concat->op_end(), - [](const SDValue &Op) { - return Op.isUndef() || - ISD::isBuildVectorOfConstantSDNodes(Op.getNode()); - }); + all_of(drop_begin(Concat->ops()), [](const SDValue &Op) { + return Op.isUndef() || +ISD::isBuildVectorOfConstantSDNodes(Op.getNode()); + }); }; // The following pattern is likely to emerge with vector reduction ops. Moving diff --git a/llvm/
[llvm-branch-commits] [llvm] 8f5da41 - [llvm] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-20T21:35:52-08:00 New Revision: 8f5da41c4d1f4468e39e97996421083542cb5915 URL: https://github.com/llvm/llvm-project/commit/8f5da41c4d1f4468e39e97996421083542cb5915 DIFF: https://github.com/llvm/llvm-project/commit/8f5da41c4d1f4468e39e97996421083542cb5915.diff LOG: [llvm] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/lib/Transforms/Scalar/NaryReassociate.cpp llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp llvm/lib/Transforms/Utils/CallPromotionUtils.cpp llvm/lib/Transforms/Utils/CodeExtractor.cpp llvm/lib/Transforms/Utils/GuardUtils.cpp Removed: diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index f8c297fb3da6..fe9d8297d679 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2177,7 +2177,7 @@ CollectAddOperandsWithScales(DenseMap &M, } else { // A multiplication of a constant with some other value. Update // the map. -SmallVector MulOps(Mul->op_begin()+1, Mul->op_end()); +SmallVector MulOps(drop_begin(Mul->operands())); const SCEV *Key = SE.getMulExpr(MulOps); auto Pair = M.insert({Key, NewScale}); if (Pair.second) { diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp index 65f8d6de1940..e07dae65fc4a 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp @@ -353,8 +353,7 @@ bool WebAssemblyLateEHPrepare::ensureSingleBBTermPads(MachineFunction &MF) { BuildMI(*EHPad, InsertPos, Call->getDebugLoc(), TII.get(WebAssembly::UNREACHABLE)); EHPad->erase(InsertPos, EHPad->end()); -SmallVector Succs(EHPad->succ_begin(), - EHPad->succ_end()); +SmallVector Succs(EHPad->successors()); for (auto *Succ : Succs) EHPad->removeSuccessor(Succ); eraseDeadBBsAndChildren(Succs); diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index e2642234ac9b..b12f53032fae 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1495,8 +1495,7 @@ static void rewritePHIsForCleanupPad(BasicBlock *CleanupPadBB, pred_size(CleanupPadBB)); int SwitchIndex = 0; - SmallVector Preds(pred_begin(CleanupPadBB), - pred_end(CleanupPadBB)); + SmallVector Preds(predecessors(CleanupPadBB)); for (BasicBlock *Pred : Preds) { // Create a new cleanuppad and move the PHI values to there. auto *CaseBB = BasicBlock::Create(CleanupPadBB->getContext(), diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 4efd29114a0f..4998ba68bc37 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -2196,7 +2196,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) { // GEP (bitcast i8* X to [0 x i8]*), i32 0, ... ? if (CATy->getElementType() == StrippedPtrEltTy) { // -> GEP i8* X, ... - SmallVector Idx(GEP.idx_begin()+1, GEP.idx_end()); + SmallVector Idx(drop_begin(GEP.indices())); GetElementPtrInst *Res = GetElementPtrInst::Create( StrippedPtrEltTy, StrippedPtr, Idx, GEP.getName()); Res->setIsInBounds(GEP.isInBounds()); diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index d189d946ab42..118cbbbd418d 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -424,7 +424,7 @@ static void DoInitialMatch(const SCEV *S, Loop *L, // Handle a multiplication by -1 (negation) if it didn't fold. if (const SCEVMulExpr *Mul = dyn_cast(S)) if (Mul->getOperand(0)->isAllOnesValue()) { - SmallVector Ops(Mul->op_begin()+1, Mul->op_end()); + SmallVector Ops(drop_begin(Mul->operands())); const SCEV *NewMul = SE.getMulExpr(Ops); SmallVector MyGood; diff --git a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp index bc1b58611dd1..32bb62129e8f 100644 --- a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp +++ b/llvm/lib/Transforms/Scalar/NaryR
[llvm-branch-commits] [llvm] e53472d - [Transforms] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-20T21:35:54-08:00 New Revision: e53472de688627c749330398063b9b7f7c8b6066 URL: https://github.com/llvm/llvm-project/commit/e53472de688627c749330398063b9b7f7c8b6066 DIFF: https://github.com/llvm/llvm-project/commit/e53472de688627c749330398063b9b7f7c8b6066.diff LOG: [Transforms] Use llvm::append_range (NFC) Added: Modified: llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp llvm/lib/Transforms/IPO/GlobalOpt.cpp llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/GVN.cpp llvm/lib/Transforms/Scalar/GVNSink.cpp llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/lib/Transforms/Utils/CloneFunction.cpp llvm/lib/Transforms/Utils/FixIrreducible.cpp llvm/lib/Transforms/Utils/LoopSimplify.cpp llvm/lib/Transforms/Utils/SSAUpdater.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp Removed: diff --git a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp index 0bcebc17af8d..16b82219e8ca 100644 --- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp +++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp @@ -130,8 +130,7 @@ bool TruncInstCombine::buildTruncExpressionDag() { case Instruction::Select: { SmallVector Operands; getRelevantOperands(I, Operands); - for (Value *Operand : Operands) -Worklist.push_back(Operand); + append_range(Worklist, Operands); break; } default: diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index b0a2194052f3..223a05e8ea02 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1933,8 +1933,7 @@ static void makeAllConstantUsesInstructions(Constant *C) { SmallVector UUsers; for (auto *U : Users) { UUsers.clear(); -for (auto *UU : U->users()) - UUsers.push_back(UU); +append_range(UUsers, U->users()); for (auto *UU : UUsers) { Instruction *UI = cast(UU); Instruction *NewU = U->getAsInstruction(); diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp index 76a88ea6b2ee..225b4fe95f67 100644 --- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -334,8 +334,7 @@ void splitAndWriteThinLTOBitcode( Linkage = CFL_Declaration; Elts.push_back(ConstantAsMetadata::get( llvm::ConstantInt::get(Type::getInt8Ty(Ctx), Linkage))); -for (auto Type : Types) - Elts.push_back(Type); +append_range(Elts, Types); CfiFunctionMDs.push_back(MDTuple::get(Ctx, Elts)); } diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index dc498719c128..cf1ff405c493 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -1279,8 +1279,7 @@ void DevirtModule::applyICallBranchFunnel(VTableSlotInfo &SlotInfo, // x86_64. std::vector NewArgs; NewArgs.push_back(Int8PtrTy); - for (Type *T : CB.getFunctionType()->params()) -NewArgs.push_back(T); + append_range(NewArgs, CB.getFunctionType()->params()); FunctionType *NewFT = FunctionType::get(CB.getFunctionType()->getReturnType(), NewArgs, CB.getFunctionType()->isVarArg()); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index fb4170b511c1..c7b5f6f78069 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -753,8 +753,7 @@ static bool isObjectSizeLessThanOrEq(Value *V, uint64_t MaxSize, } if (PHINode *PN = dyn_cast(P)) { - for (Value *IncValue : PN->incoming_values()) -Worklist.push_back(IncValue); + append_range(Worklist, PN->incoming_values()); continue; } diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 4998ba68bc37..570a07ec6a5a 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3827,8 +3827,7 @@ static bool prepareICWorklistFromFunction(Function &F, const DataLayout &DL, } } -for (BasicBlock *SuccBB : successors(TI)) - Worklist.push_back(SuccBB); +append_range(Worklist, successors(TI)); } while (!Worklist.empty()); /
[llvm-branch-commits] [llvm] 6de4865 - [llvm] Use hasSingleElement (NFC)
Author: Kazu Hirata Date: 2021-01-20T21:35:55-08:00 New Revision: 6de4865545da73687dd6d28d153cd345ed5e7918 URL: https://github.com/llvm/llvm-project/commit/6de4865545da73687dd6d28d153cd345ed5e7918 DIFF: https://github.com/llvm/llvm-project/commit/6de4865545da73687dd6d28d153cd345ed5e7918.diff LOG: [llvm] Use hasSingleElement (NFC) Added: Modified: llvm/include/llvm/CodeGen/MachineRegisterInfo.h llvm/include/llvm/CodeGen/SelectionDAGNodes.h llvm/include/llvm/IR/Value.h llvm/lib/CodeGen/MachineRegisterInfo.cpp llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h index a1a67058cc55..57086b4eebd6 100644 --- a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h @@ -442,10 +442,7 @@ class MachineRegisterInfo { /// Return true if there is exactly one operand defining the specified /// register. bool hasOneDef(Register RegNo) const { -def_iterator DI = def_begin(RegNo); -if (DI == def_end()) - return false; -return ++DI == def_end(); +return hasSingleElement(def_operands(RegNo)); } /// Returns the defining operand if there is exactly one operand defining the @@ -511,10 +508,7 @@ class MachineRegisterInfo { /// hasOneUse - Return true if there is exactly one instruction using the /// specified register. bool hasOneUse(Register RegNo) const { -use_iterator UI = use_begin(RegNo); -if (UI == use_end()) - return false; -return ++UI == use_end(); +return hasSingleElement(use_operands(RegNo)); } /// use_nodbg_iterator/use_nodbg_begin/use_nodbg_end - Walk all uses of the diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index 3d122402bf57..000e383b71eb 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -689,9 +689,7 @@ END_TWO_BYTE_PACK() bool use_empty() const { return UseList == nullptr; } /// Return true if there is exactly one use of this node. - bool hasOneUse() const { -return !use_empty() && std::next(use_begin()) == use_end(); - } + bool hasOneUse() const { return hasSingleElement(uses()); } /// Return the number of uses of this node. This method takes /// time proportional to the number of uses. diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index e84840a30e96..2a9912d46c89 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -434,11 +434,7 @@ class Value { /// /// This is specialized because it is a common request and does not require /// traversing the whole use list. - bool hasOneUse() const { -const_use_iterator I = use_begin(), E = use_end(); -if (I == E) return false; -return ++I == E; - } + bool hasOneUse() const { return hasSingleElement(uses()); } /// Return true if this Value has exactly N uses. bool hasNUses(unsigned N) const; diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index 9165d6d7bb10..b34ea8162f72 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -417,17 +417,11 @@ MachineInstr *MachineRegisterInfo::getUniqueVRegDef(Register Reg) const { } bool MachineRegisterInfo::hasOneNonDBGUse(Register RegNo) const { - use_nodbg_iterator UI = use_nodbg_begin(RegNo); - if (UI == use_nodbg_end()) -return false; - return ++UI == use_nodbg_end(); + return hasSingleElement(use_nodbg_operands(RegNo)); } bool MachineRegisterInfo::hasOneNonDBGUser(Register RegNo) const { - use_instr_nodbg_iterator UI = use_instr_nodbg_begin(RegNo); - if (UI == use_instr_nodbg_end()) -return false; - return ++UI == use_instr_nodbg_end(); + return hasSingleElement(use_nodbg_instructions(RegNo)); } /// clearKillFlags - Iterate over all the uses of the given register and diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index ffd7d1e62c94..8493950a29b2 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -194,13 +194,12 @@ Optional DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const { if (IsDWO) { auto R = Context.info_section_units(); -auto I = R.begin(); // Surprising if a DWO file has more than one skeleton unit in it - this // probably shouldn't be valid, but if a use case is found, here's where to // support it (probably have to linearly search for the matching skeleton CU // here) -if (I != R.end() && std::next(I) == R.end()) - return (*I)->getAddrOffsetSectionItem(Index); +if (hasSingleElement(R)) + return (*R.begin())->getAddrOffsetSectionItem(Index); } if (!Add
[llvm-branch-commits] [llvm] cfa2416 - [llvm] Don't include StringSwitch.h where unnecessary (NFC)
Author: Kazu Hirata Date: 2021-01-21T19:59:48-08:00 New Revision: cfa241680fd6c5d804fa57406100692f923d679f URL: https://github.com/llvm/llvm-project/commit/cfa241680fd6c5d804fa57406100692f923d679f DIFF: https://github.com/llvm/llvm-project/commit/cfa241680fd6c5d804fa57406100692f923d679f.diff LOG: [llvm] Don't include StringSwitch.h where unnecessary (NFC) Added: Modified: llvm/lib/Analysis/ObjCARCInstKind.cpp llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp llvm/lib/IR/Core.cpp llvm/lib/MC/MCParser/COFFMasmParser.cpp llvm/lib/ObjectYAML/COFFEmitter.cpp llvm/lib/Support/X86TargetParser.cpp llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/tools/dsymutil/dsymutil.cpp llvm/tools/llvm-cvtres/llvm-cvtres.cpp Removed: diff --git a/llvm/lib/Analysis/ObjCARCInstKind.cpp b/llvm/lib/Analysis/ObjCARCInstKind.cpp index fb416a79ac26..951907804227 100644 --- a/llvm/lib/Analysis/ObjCARCInstKind.cpp +++ b/llvm/lib/Analysis/ObjCARCInstKind.cpp @@ -19,7 +19,6 @@ //===--===// #include "llvm/Analysis/ObjCARCInstKind.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" #include "llvm/IR/Intrinsics.h" diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index fdedb6beac35..fc8d1eb238a9 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -15,7 +15,6 @@ #include "llvm/Frontend/OpenMP/OMPIRBuilder.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/IR/CFG.h" #include "llvm/IR/DebugInfo.h" diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 4d5df273bf39..90ba69069bae 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -12,7 +12,6 @@ //===--===// #include "llvm-c/Core.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DebugInfoMetadata.h" diff --git a/llvm/lib/MC/MCParser/COFFMasmParser.cpp b/llvm/lib/MC/MCParser/COFFMasmParser.cpp index aacce928c141..95128cf7d184 100644 --- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp @@ -7,7 +7,6 @@ //===--===// #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/COFF.h" diff --git a/llvm/lib/ObjectYAML/COFFEmitter.cpp b/llvm/lib/ObjectYAML/COFFEmitter.cpp index 734e1be4b2d5..06ce93affd38 100644 --- a/llvm/lib/ObjectYAML/COFFEmitter.cpp +++ b/llvm/lib/ObjectYAML/COFFEmitter.cpp @@ -14,7 +14,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h" #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h" #include "llvm/Object/COFF.h" diff --git a/llvm/lib/Support/X86TargetParser.cpp b/llvm/lib/Support/X86TargetParser.cpp index 131bfd5eb6ac..d738511465b4 100644 --- a/llvm/lib/Support/X86TargetParser.cpp +++ b/llvm/lib/Support/X86TargetParser.cpp @@ -11,7 +11,6 @@ //===--===// #include "llvm/Support/X86TargetParser.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" using namespace llvm; diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 6dd081dc3cb7..f485490199fd 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -27,7 +27,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/Analysis/VectorUtils.h" diff --git a/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp b/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp index 0abe42d22120..19f769270569 100644 --- a/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp +++ b/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp @@ -14,7 +14,6 @@ #include "TargetInfo/AVRTargetInfo.h" #include "llvm/ADT/APInt.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" diff --git a/llvm/lib/Target/M
[llvm-branch-commits] [llvm] 551aaa2 - [llvm] Use isDigit (NFC)
Author: Kazu Hirata Date: 2021-01-21T19:59:50-08:00 New Revision: 551aaa24afe6d029cc96399bcece948a5217530b URL: https://github.com/llvm/llvm-project/commit/551aaa24afe6d029cc96399bcece948a5217530b DIFF: https://github.com/llvm/llvm-project/commit/551aaa24afe6d029cc96399bcece948a5217530b.diff LOG: [llvm] Use isDigit (NFC) Added: Modified: llvm/include/llvm/TableGen/Record.h llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp llvm/lib/CodeGen/TargetLoweringBase.cpp llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/ProfileData/SampleProfReader.cpp llvm/lib/Support/Triple.cpp Removed: diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 2853a471b67f..b71aa0a89056 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -20,6 +20,7 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" @@ -1866,8 +1867,6 @@ struct LessRecordFieldName { }; struct LessRecordRegister { - static bool ascii_isdigit(char x) { return x >= '0' && x <= '9'; } - struct RecordParts { SmallVector, 4> Parts; @@ -1878,18 +1877,18 @@ struct LessRecordRegister { size_t Len = 0; const char *Start = Rec.data(); const char *Curr = Start; - bool isDigitPart = ascii_isdigit(Curr[0]); + bool IsDigitPart = isDigit(Curr[0]); for (size_t I = 0, E = Rec.size(); I != E; ++I, ++Len) { -bool isDigit = ascii_isdigit(Curr[I]); -if (isDigit != isDigitPart) { - Parts.push_back(std::make_pair(isDigitPart, StringRef(Start, Len))); +bool IsDigit = isDigit(Curr[I]); +if (IsDigit != IsDigitPart) { + Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len))); Len = 0; Start = &Curr[I]; - isDigitPart = ascii_isdigit(Curr[I]); + IsDigitPart = isDigit(Curr[I]); } } // Push the last part. - Parts.push_back(std::make_pair(isDigitPart, StringRef(Start, Len))); + Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len))); } size_t size() { return Parts.size(); } diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 3a51134b494e..4a67b0bc2c4d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -234,7 +234,8 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI, const char *IDStart = LastEmitted; const char *IDEnd = IDStart; - while (*IDEnd >= '0' && *IDEnd <= '9') ++IDEnd; + while (isDigit(*IDEnd)) +++IDEnd; unsigned Val; if (StringRef(IDStart, IDEnd-IDStart).getAsInteger(10, Val)) @@ -399,7 +400,8 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI, const char *IDStart = LastEmitted; const char *IDEnd = IDStart; - while (*IDEnd >= '0' && *IDEnd <= '9') ++IDEnd; + while (isDigit(*IDEnd)) +++IDEnd; unsigned Val; if (StringRef(IDStart, IDEnd-IDStart).getAsInteger(10, Val)) diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index f639f7295b57..7aa569147da4 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -2077,7 +2077,7 @@ static bool parseRefinementStep(StringRef In, size_t &Position, // step parameter. if (RefStepString.size() == 1) { char RefStepChar = RefStepString[0]; -if (RefStepChar >= '0' && RefStepChar <= '9') { +if (isDigit(RefStepChar)) { Value = RefStepChar - '0'; return true; } diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 4c3f3a3767e1..da157a5a2554 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -589,10 +589,8 @@ StringRef demanglePE32ExternCFunc(StringRef SymbolName) { if (Front != '?') { size_t AtPos = SymbolName.rfind('@'); if (AtPos != StringRef::npos && -all_of(drop_begin(SymbolName, AtPos + 1), - [](char C) { return C >= '0' && C <= '9'; })) { +all_of(drop_begin(SymbolName, AtPos + 1), isDigit)) SymbolName = SymbolName.substr(0, AtPos); -} } // Remove any ending '@' for vectorcall. diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 2b2456c3b479..69abf8769e4b 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1368,9 +1368,8 @@ static void WriteConstantInternal(raw_os
[llvm-branch-commits] [llvm] c5c4dbd - [CodeGen] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-21T19:59:46-08:00 New Revision: c5c4dbd2790736008b1c60f1b737dfb824b90144 URL: https://github.com/llvm/llvm-project/commit/c5c4dbd2790736008b1c60f1b737dfb824b90144 DIFF: https://github.com/llvm/llvm-project/commit/c5c4dbd2790736008b1c60f1b737dfb824b90144.diff LOG: [CodeGen] Use llvm::append_range (NFC) Added: Modified: llvm/lib/CodeGen/Analysis.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp llvm/lib/CodeGen/MIRCanonicalizerPass.cpp llvm/lib/CodeGen/MachineCSE.cpp llvm/lib/CodeGen/MachineRegisterInfo.cpp llvm/lib/CodeGen/MachineVerifier.cpp llvm/lib/CodeGen/SplitKit.cpp Removed: diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp index 67eb079afb49..ebeff1fec30b 100644 --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -733,8 +733,7 @@ static void collectEHScopeMembers( if (Visiting->isEHScopeReturnBlock()) continue; -for (const MachineBasicBlock *Succ : Visiting->successors()) - Worklist.push_back(Succ); +append_range(Worklist, Visiting->successors()); } } diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index c2fccab947d6..b2bc75c19709 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -3714,8 +3714,7 @@ class AddressingModeCombiner { PHINode::Create(CommonType, PredCount, "sunk_phi", CurrentPhi); Map[Current] = PHI; ST.insertNewPhi(PHI); -for (Value *P : CurrentPhi->incoming_values()) - Worklist.push_back(P); +append_range(Worklist, CurrentPhi->incoming_values()); } } } @@ -4969,8 +4968,7 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, // For a PHI node, push all of its incoming values. if (PHINode *P = dyn_cast(V)) { - for (Value *IncValue : P->incoming_values()) -worklist.push_back(IncValue); + append_range(worklist, P->incoming_values()); PhiOrSelectSeen = true; continue; } diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index 255ea693b5c4..e2a963747101 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -421,8 +421,7 @@ RegisterBankInfo::getInstrPossibleMappings(const MachineInstr &MI) const { // Then the alternative mapping, if any. InstructionMappings AltMappings = getInstrAlternativeMappings(MI); - for (const InstructionMapping *AltMapping : AltMappings) -PossibleMappings.push_back(AltMapping); + append_range(PossibleMappings, AltMappings); #ifndef NDEBUG for (const InstructionMapping *Mapping : PossibleMappings) assert(Mapping->verify(MI) && "Mapping is invalid"); diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp index b6fb6731d65c..8ef6aca602a1 100644 --- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp +++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp @@ -85,9 +85,7 @@ static std::vector GetRPOList(MachineFunction &MF) { return {}; ReversePostOrderTraversal RPOT(&*MF.begin()); std::vector RPOList; - for (auto MBB : RPOT) { -RPOList.push_back(MBB); - } + append_range(RPOList, RPOT); return RPOList; } diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp index d8e95fa5cd6c..199fe2dc6454 100644 --- a/llvm/lib/CodeGen/MachineCSE.cpp +++ b/llvm/lib/CodeGen/MachineCSE.cpp @@ -748,8 +748,7 @@ bool MachineCSE::PerformCSE(MachineDomTreeNode *Node) { Node = WorkList.pop_back_val(); Scopes.push_back(Node); OpenChildren[Node] = Node->getNumChildren(); -for (MachineDomTreeNode *Child : Node->children()) - WorkList.push_back(Child); +append_range(WorkList, Node->children()); } while (!WorkList.empty()); // Now perform CSE. @@ -861,8 +860,7 @@ bool MachineCSE::PerformSimplePRE(MachineDominatorTree *DT) { BBs.push_back(DT->getRootNode()); do { auto Node = BBs.pop_back_val(); -for (MachineDomTreeNode *Child : Node->children()) - BBs.push_back(Child); +append_range(BBs, Node->children()); MachineBasicBlock *MBB = Node->getBlock(); Changed |= ProcessBlockPRE(DT, MBB); diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index b34ea8162f72..5325eda9d478 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -631,8 +631,7 @@ void MachineRegisterInfo::setCalleeSavedRegs(ArrayRef CSRs) { if (IsUpdatedCSRsInitialized) UpdatedCSRs.clear(); - for (MCPhysReg Reg : CSRs) -UpdatedCSRs.push_back(Reg); + append_range(UpdatedCSRs, CSRs); // Zero value represents the
[llvm-branch-commits] [llvm] 1e3ed09 - [CodeGen] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2020-12-28T19:55:16-08:00 New Revision: 1e3ed09165cf89b7f87318b4a5f7cab484661d49 URL: https://github.com/llvm/llvm-project/commit/1e3ed09165cf89b7f87318b4a5f7cab484661d49 DIFF: https://github.com/llvm/llvm-project/commit/1e3ed09165cf89b7f87318b4a5f7cab484661d49.diff LOG: [CodeGen] Use llvm::append_range (NFC) Added: Modified: llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/MachineFunction.cpp llvm/lib/CodeGen/MachineModuleInfo.cpp llvm/lib/CodeGen/MachineOutliner.cpp llvm/lib/CodeGen/MachinePipeliner.cpp llvm/lib/CodeGen/RDFLiveness.cpp llvm/lib/CodeGen/ReachingDefAnalysis.cpp llvm/lib/CodeGen/RegAllocPBQP.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Removed: diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp index 609afed8fe9f..1e3f33e70715 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinCFGuard.cpp @@ -38,8 +38,7 @@ void WinCFGuard::endFunction(const MachineFunction *MF) { return; // Copy the function's longjmp targets to a module-level list. - LongjmpTargets.insert(LongjmpTargets.end(), MF->getLongjmpTargets().begin(), -MF->getLongjmpTargets().end()); + llvm::append_range(LongjmpTargets, MF->getLongjmpTargets()); } /// Returns true if this function's address is escaped in a way that might make diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index ec3a7e7982b2..0698c3c3b993 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -737,7 +737,7 @@ bool CodeGenPrepare::eliminateMostlyEmptyBlocks(Function &F) { SmallVector LoopList(LI->begin(), LI->end()); while (!LoopList.empty()) { Loop *L = LoopList.pop_back_val(); -LoopList.insert(LoopList.end(), L->begin(), L->end()); +llvm::append_range(LoopList, *L); if (BasicBlock *Preheader = L->getLoopPreheader()) Preheaders.insert(Preheader); } diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 2a9a88af3ad6..1eb191465ac9 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -868,7 +868,7 @@ try_next:; // Add the new filter. int FilterID = -(1 + FilterIds.size()); FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); - FilterIds.insert(FilterIds.end(), TyIds.begin(), TyIds.end()); + llvm::append_range(FilterIds, TyIds); FilterEnds.push_back(FilterIds.size()); FilterIds.push_back(0); // terminator return FilterID; diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 5c2e2fb16b69..5565b9cededa 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -144,8 +144,7 @@ void MMIAddrLabelMap::UpdateForRAUWBlock(BasicBlock *Old, BasicBlock *New) { BBCallbacks[OldEntry.Index] = nullptr;// Update the callback. // Otherwise, we need to add the old symbols to the new block's set. - NewEntry.Symbols.insert(NewEntry.Symbols.end(), OldEntry.Symbols.begin(), - OldEntry.Symbols.end()); + llvm::append_range(NewEntry.Symbols, OldEntry.Symbols); } void MMIAddrLabelMapCallbackPtr::deleted() { diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index a94a6e29dab9..ec3668a7b505 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -307,10 +307,8 @@ struct InstructionMapper { // repeated substring. mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB, InstrListForMBB); - InstrList.insert(InstrList.end(), InstrListForMBB.begin(), - InstrListForMBB.end()); - UnsignedVec.insert(UnsignedVec.end(), UnsignedVecForMBB.begin(), - UnsignedVecForMBB.end()); + llvm::append_range(InstrList, InstrListForMBB); + llvm::append_range(UnsignedVec, UnsignedVecForMBB); } } diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index c122800a196c..db4d78af5fa6 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -2953,7 +2953,7 @@ void SMSchedule::finalizeSchedule(SwingSchedulerDAG *SSD) { } // Replace the old order with the new order. cycleInstrs.swap(newOrderPhi); -cycleInstrs.insert(cycleInstrs.end(), newOrderI.begin(), newOrderI.end()); +llvm::append_range(cycleInstrs, newOrderI); SSD->fixupRegisterOverlaps(
[llvm-branch-commits] [llvm] 5d2529f - [Scalar] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2020-12-28T19:55:18-08:00 New Revision: 5d2529f28f93a08c33bb3a22387e669075b66504 URL: https://github.com/llvm/llvm-project/commit/5d2529f28f93a08c33bb3a22387e669075b66504 DIFF: https://github.com/llvm/llvm-project/commit/5d2529f28f93a08c33bb3a22387e669075b66504.diff LOG: [Scalar] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Transforms/Scalar/GVN.cpp llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/lib/Transforms/Scalar/Reassociate.cpp llvm/lib/Transforms/Scalar/SROA.cpp Removed: diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 30d00758c662..448ff498b110 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -2800,7 +2800,7 @@ void GVN::addDeadBlock(BasicBlock *BB) { // First, split the critical edges. This might also create additional blocks // to preserve LoopSimplify form and adjust edges accordingly. -SmallVector Preds(pred_begin(B), pred_end(B)); +SmallVector Preds(predecessors(B)); for (BasicBlock *P : Preds) { if (!DeadBlocks.count(P)) continue; diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index 0753a0c259ab..d7d8f780b125 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -597,7 +597,7 @@ Value *InferAddressSpaces::cloneInstructionWithNewAddressSpace( GetElementPtrInst *GEP = cast(I); GetElementPtrInst *NewGEP = GetElementPtrInst::Create( GEP->getSourceElementType(), NewPointerOperands[0], -SmallVector(GEP->idx_begin(), GEP->idx_end())); +SmallVector(GEP->indices())); NewGEP->setIsInBounds(GEP->isInBounds()); return NewGEP; } diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 0f82e196602f..7742ebafcac4 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -755,13 +755,13 @@ static int64_t ExtractImmediate(const SCEV *&S, ScalarEvolution &SE) { return C->getValue()->getSExtValue(); } } else if (const SCEVAddExpr *Add = dyn_cast(S)) { -SmallVector NewOps(Add->op_begin(), Add->op_end()); +SmallVector NewOps(Add->operands()); int64_t Result = ExtractImmediate(NewOps.front(), SE); if (Result != 0) S = SE.getAddExpr(NewOps); return Result; } else if (const SCEVAddRecExpr *AR = dyn_cast(S)) { -SmallVector NewOps(AR->op_begin(), AR->op_end()); +SmallVector NewOps(AR->operands()); int64_t Result = ExtractImmediate(NewOps.front(), SE); if (Result != 0) S = SE.getAddRecExpr(NewOps, AR->getLoop(), @@ -781,13 +781,13 @@ static GlobalValue *ExtractSymbol(const SCEV *&S, ScalarEvolution &SE) { return GV; } } else if (const SCEVAddExpr *Add = dyn_cast(S)) { -SmallVector NewOps(Add->op_begin(), Add->op_end()); +SmallVector NewOps(Add->operands()); GlobalValue *Result = ExtractSymbol(NewOps.back(), SE); if (Result) S = SE.getAddExpr(NewOps); return Result; } else if (const SCEVAddRecExpr *AR = dyn_cast(S)) { -SmallVector NewOps(AR->op_begin(), AR->op_end()); +SmallVector NewOps(AR->operands()); GlobalValue *Result = ExtractSymbol(NewOps.front(), SE); if (Result) S = SE.getAddRecExpr(NewOps, AR->getLoop(), diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 4f774bed1472..04e7a59c0d0c 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -1993,7 +1993,7 @@ Value *ReassociatePass::OptimizeExpression(BinaryOperator *I, void ReassociatePass::RecursivelyEraseDeadInsts(Instruction *I, OrderedSet &Insts) { assert(isInstructionTriviallyDead(I) && "Trivially dead instructions only!"); - SmallVector Ops(I->op_begin(), I->op_end()); + SmallVector Ops(I->operands()); ValueRankMap.erase(I); Insts.remove(I); RedoInsts.remove(I); @@ -2010,7 +2010,7 @@ void ReassociatePass::EraseInst(Instruction *I) { assert(isInstructionTriviallyDead(I) && "Trivially dead instructions only!"); LLVM_DEBUG(dbgs() << "Erasing dead inst: "; I->dump()); - SmallVector Ops(I->op_begin(), I->op_end()); + SmallVector Ops(I->operands()); // Erase the dead instruction. ValueRankMap.erase(I); RedoInsts.remove(I); diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 7df98694c8b0..ed68ce6f8282 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -3477,7 +3477,7 @@
[llvm-branch-commits] [llvm] 2883cd9 - [CFGPrinter] Use succ_empty (NFC)
Author: Kazu Hirata Date: 2020-12-28T19:55:20-08:00 New Revision: 2883cd98f3c04b6ee804a5c3ad897f7f0acf0bfa URL: https://github.com/llvm/llvm-project/commit/2883cd98f3c04b6ee804a5c3ad897f7f0acf0bfa DIFF: https://github.com/llvm/llvm-project/commit/2883cd98f3c04b6ee804a5c3ad897f7f0acf0bfa.diff LOG: [CFGPrinter] Use succ_empty (NFC) Added: Modified: llvm/lib/Analysis/CFGPrinter.cpp Removed: diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp index 582e61b33f49..d41b0f8d48eb 100644 --- a/llvm/lib/Analysis/CFGPrinter.cpp +++ b/llvm/lib/Analysis/CFGPrinter.cpp @@ -272,7 +272,7 @@ FunctionPass *llvm::createCFGOnlyPrinterLegacyPassPass() { void DOTGraphTraits::computeHiddenNodes(const Function *F) { auto evaluateBB = [&](const BasicBlock *Node) { -if (succ_begin(Node) == succ_end(Node)) { +if (succ_empty(Node)) { const Instruction *TI = Node->getTerminator(); isHiddenBasicBlock[Node] = (HideUnreachablePaths && isa(TI)) || ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f76e83b - [Analysis] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2020-12-29T19:23:21-08:00 New Revision: f76e83bfbba9fcaf6f2e3d869774302d721ba1e4 URL: https://github.com/llvm/llvm-project/commit/f76e83bfbba9fcaf6f2e3d869774302d721ba1e4 DIFF: https://github.com/llvm/llvm-project/commit/f76e83bfbba9fcaf6f2e3d869774302d721ba1e4.diff LOG: [Analysis] Use llvm::append_range (NFC) Added: Modified: llvm/include/llvm/Analysis/DDG.h llvm/include/llvm/Analysis/IntervalIterator.h llvm/lib/Analysis/AliasSetTracker.cpp llvm/lib/Analysis/DDG.cpp llvm/lib/Analysis/DependenceGraphBuilder.cpp llvm/lib/Analysis/IRSimilarityIdentifier.cpp llvm/lib/Analysis/LazyValueInfo.cpp llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/Analysis/TargetLibraryInfo.cpp Removed: diff --git a/llvm/include/llvm/Analysis/DDG.h b/llvm/include/llvm/Analysis/DDG.h index 8d225c155cd4..e3bef33e55c3 100644 --- a/llvm/include/llvm/Analysis/DDG.h +++ b/llvm/include/llvm/Analysis/DDG.h @@ -152,7 +152,7 @@ class SimpleDDGNode : public DDGNode { setKind((InstList.size() == 0 && Input.size() == 1) ? NodeKind::SingleInstruction : NodeKind::MultiInstruction); -InstList.insert(InstList.end(), Input.begin(), Input.end()); +llvm::append_range(InstList, Input); } void appendInstructions(const SimpleDDGNode &Input) { appendInstructions(Input.getInstructions()); diff --git a/llvm/include/llvm/Analysis/IntervalIterator.h b/llvm/include/llvm/Analysis/IntervalIterator.h index 38bb3bbb1719..8e2273618a66 100644 --- a/llvm/include/llvm/Analysis/IntervalIterator.h +++ b/llvm/include/llvm/Analysis/IntervalIterator.h @@ -81,7 +81,7 @@ inline void addNodeToInterval(Interval *Int, BasicBlock *BB) { // BasicBlocks are added to the interval. inline void addNodeToInterval(Interval *Int, Interval *I) { // Add all of the nodes in I as new nodes in Int. - Int->Nodes.insert(Int->Nodes.end(), I->Nodes.begin(), I->Nodes.end()); + llvm::append_range(Int->Nodes, I->Nodes); } template, diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 77dba3444e3d..9b21fbf4c9b7 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -83,7 +83,7 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) { addRef(); } } else if (ASHadUnknownInsts) { -UnknownInsts.insert(UnknownInsts.end(), AS.UnknownInsts.begin(), AS.UnknownInsts.end()); +llvm::append_range(UnknownInsts, AS.UnknownInsts); AS.UnknownInsts.clear(); } diff --git a/llvm/lib/Analysis/DDG.cpp b/llvm/lib/Analysis/DDG.cpp index 280d9ef79efa..b2aa322454e7 100644 --- a/llvm/lib/Analysis/DDG.cpp +++ b/llvm/lib/Analysis/DDG.cpp @@ -49,7 +49,7 @@ bool DDGNode::collectInstructions( assert(!isa(PN) && "Nested PiBlocks are not supported."); SmallVector TmpIList; PN->collectInstructions(Pred, TmpIList); - IList.insert(IList.end(), TmpIList.begin(), TmpIList.end()); + llvm::append_range(IList, TmpIList); } } else llvm_unreachable("unimplemented type of node"); diff --git a/llvm/lib/Analysis/DependenceGraphBuilder.cpp b/llvm/lib/Analysis/DependenceGraphBuilder.cpp index 7a98d844e4cb..fbf0f6651599 100644 --- a/llvm/lib/Analysis/DependenceGraphBuilder.cpp +++ b/llvm/lib/Analysis/DependenceGraphBuilder.cpp @@ -492,8 +492,7 @@ void AbstractDependenceGraphBuilder::sortNodesTopologically() { // Put members of the pi-block right after the pi-block itself, for // convenience. const NodeListType &PiBlockMembers = getNodesInPiBlock(*N); - NodesInPO.insert(NodesInPO.end(), PiBlockMembers.begin(), - PiBlockMembers.end()); + llvm::append_range(NodesInPO, PiBlockMembers); } NodesInPO.push_back(N); } diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp index 4ee152450c05..141c1e0a5d03 100644 --- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp +++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp @@ -138,10 +138,8 @@ void IRInstructionMapper::convertToUnsignedVec( mapToIllegalUnsigned(It, IntegerMappingForBB, InstrListForBB, true); for_each(InstrListForBB, [this](IRInstructionData *ID) { this->IDL->push_back(*ID); }); -InstrList.insert(InstrList.end(), InstrListForBB.begin(), - InstrListForBB.end()); -IntegerMapping.insert(IntegerMapping.end(), IntegerMappingForBB.begin(), - IntegerMappingForBB.end()); +llvm::append_range(InstrList, InstrListForBB); +llvm::append_range(IntegerMapping, IntegerMappingForBB); } } @@ -639,11 +637,9 @@ void IRSimilarityIdentifier::populateMapper( // Insert the InstrListForModule at the end of the overall InstrList so that // we can have a long InstrList for the entire set of Modules be
[llvm-branch-commits] [llvm] 16d20e2 - [Transforms/Utils] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2020-12-29T19:23:23-08:00 New Revision: 16d20e2554e9e8aac7ecf98df640da29e8de69ce URL: https://github.com/llvm/llvm-project/commit/16d20e2554e9e8aac7ecf98df640da29e8de69ce DIFF: https://github.com/llvm/llvm-project/commit/16d20e2554e9e8aac7ecf98df640da29e8de69ce.diff LOG: [Transforms/Utils] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Transforms/Utils/Local.cpp llvm/lib/Transforms/Utils/LowerInvoke.cpp llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp Removed: diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index e32b0f142f07..f2bc8a801a75 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2050,7 +2050,7 @@ unsigned llvm::changeToUnreachable(Instruction *I, bool UseLLVMTrap, } CallInst *llvm::createCallMatchingInvoke(InvokeInst *II) { - SmallVector Args(II->arg_begin(), II->arg_end()); + SmallVector Args(II->args()); SmallVector OpBundles; II->getOperandBundlesAsDefs(OpBundles); CallInst *NewCall = CallInst::Create(II->getFunctionType(), @@ -2107,7 +2107,7 @@ BasicBlock *llvm::changeToInvokeAndSplitBasicBlock(CallInst *CI, BB->getInstList().pop_back(); // Create the new invoke instruction. - SmallVector InvokeArgs(CI->arg_begin(), CI->arg_end()); + SmallVector InvokeArgs(CI->args()); SmallVector OpBundles; CI->getOperandBundlesAsDefs(OpBundles); diff --git a/llvm/lib/Transforms/Utils/LowerInvoke.cpp b/llvm/lib/Transforms/Utils/LowerInvoke.cpp index 0b225e8abc4e..fe0ff5899d8f 100644 --- a/llvm/lib/Transforms/Utils/LowerInvoke.cpp +++ b/llvm/lib/Transforms/Utils/LowerInvoke.cpp @@ -48,7 +48,7 @@ static bool runImpl(Function &F) { bool Changed = false; for (BasicBlock &BB : F) if (InvokeInst *II = dyn_cast(BB.getTerminator())) { - SmallVector CallArgs(II->arg_begin(), II->arg_end()); + SmallVector CallArgs(II->args()); SmallVector OpBundles; II->getOperandBundlesAsDefs(OpBundles); // Insert a normal call instruction... diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index a59e8ec47a83..27b4b1f0740e 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -740,7 +740,7 @@ void PromoteMem2Reg::run() { continue; // Get the preds for BB. -SmallVector Preds(pred_begin(BB), pred_end(BB)); +SmallVector Preds(predecessors(BB)); // Ok, now we know that all of the PHI nodes are missing entries for some // basic blocks. Start by sorting the incoming predecessors for efficient diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index c7e37fe0d1b3..6c112b586f1a 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -309,7 +309,7 @@ static bool FactorOutConstant(const SCEV *&S, const SCEV *&Remainder, if (const SCEVConstant *FC = dyn_cast(Factor)) if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) if (!C->getAPInt().srem(FC->getAPInt())) { - SmallVector NewMulOps(M->op_begin(), M->op_end()); + SmallVector NewMulOps(M->operands()); NewMulOps[0] = SE.getConstant(C->getAPInt().sdiv(FC->getAPInt())); S = SE.getMulExpr(NewMulOps); return true; @@ -911,7 +911,7 @@ static void ExposePointerBase(const SCEV *&Base, const SCEV *&Rest, } if (const SCEVAddExpr *A = dyn_cast(Base)) { Base = A->getOperand(A->getNumOperands()-1); -SmallVector NewAddOps(A->op_begin(), A->op_end()); +SmallVector NewAddOps(A->operands()); NewAddOps.back() = Rest; Rest = SE.getAddExpr(NewAddOps); ExposePointerBase(Base, Rest, SE); @@ -1556,7 +1556,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { // {X,+,F} --> X + {0,+,F} if (!S->getStart()->isZero()) { -SmallVector NewOps(S->op_begin(), S->op_end()); +SmallVector NewOps(S->operands()); NewOps[0] = SE.getConstant(Ty, 0); const SCEV *Rest = SE.getAddRecExpr(NewOps, L, S->getNoWrapFlags(SCEV::FlagNW)); diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 24572810be70..5b60faee751a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1076,7 +1076,7 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI, ++NumFoldValueComparisonIntoPredecessors; }); - SmallVector Preds(pred_begin(BB), pred_end(BB)); + SmallVe
[llvm-branch-commits] [llvm] 329b887 - [Analysis, IR] Use *Map::lookup (NFC)
Author: Kazu Hirata Date: 2020-12-29T19:23:24-08:00 New Revision: 329b887286ab91872decd56adf1bb87aa30f9707 URL: https://github.com/llvm/llvm-project/commit/329b887286ab91872decd56adf1bb87aa30f9707 DIFF: https://github.com/llvm/llvm-project/commit/329b887286ab91872decd56adf1bb87aa30f9707.diff LOG: [Analysis, IR] Use *Map::lookup (NFC) Added: Modified: llvm/include/llvm/Analysis/RegionInfoImpl.h llvm/include/llvm/Analysis/VectorUtils.h llvm/lib/IR/PassRegistry.cpp llvm/lib/IR/SafepointIRVerifier.cpp Removed: diff --git a/llvm/include/llvm/Analysis/RegionInfoImpl.h b/llvm/include/llvm/Analysis/RegionInfoImpl.h index bbd3dd5dc0ea..d28aee72dda5 100644 --- a/llvm/include/llvm/Analysis/RegionInfoImpl.h +++ b/llvm/include/llvm/Analysis/RegionInfoImpl.h @@ -815,8 +815,7 @@ void RegionInfoBase::verifyAnalysis() const { // Region pass manager support. template typename Tr::RegionT *RegionInfoBase::getRegionFor(BlockT *BB) const { - typename BBtoRegionMap::const_iterator I = BBtoRegion.find(BB); - return I != BBtoRegion.end() ? I->second : nullptr; + return BBtoRegion.lookup(BB); } template diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index c570bf25e92b..d8fb970a9f79 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -655,11 +655,7 @@ template class InterleaveGroup { /// \returns nullptr if contains no such member. InstTy *getMember(uint32_t Index) const { int32_t Key = SmallestKey + Index; -auto Member = Members.find(Key); -if (Member == Members.end()) - return nullptr; - -return Member->second; +return Members.lookup(Key); } /// Get the index for the given member. Unlike the key in the member @@ -777,9 +773,7 @@ class InterleavedAccessInfo { /// \returns nullptr if doesn't have such group. InterleaveGroup * getInterleaveGroup(const Instruction *Instr) const { -if (InterleaveGroupMap.count(Instr)) - return InterleaveGroupMap.find(Instr)->second; -return nullptr; +return InterleaveGroupMap.lookup(Instr); } iterator_range *>> diff --git a/llvm/lib/IR/PassRegistry.cpp b/llvm/lib/IR/PassRegistry.cpp index 0572c4fe5237..94f607afec47 100644 --- a/llvm/lib/IR/PassRegistry.cpp +++ b/llvm/lib/IR/PassRegistry.cpp @@ -40,14 +40,12 @@ PassRegistry::~PassRegistry() = default; const PassInfo *PassRegistry::getPassInfo(const void *TI) const { sys::SmartScopedReader Guard(Lock); - MapType::const_iterator I = PassInfoMap.find(TI); - return I != PassInfoMap.end() ? I->second : nullptr; + return PassInfoMap.lookup(TI); } const PassInfo *PassRegistry::getPassInfo(StringRef Arg) const { sys::SmartScopedReader Guard(Lock); - StringMapType::const_iterator I = PassInfoStringMap.find(Arg); - return I != PassInfoStringMap.end() ? I->second : nullptr; + return PassInfoStringMap.lookup(Arg); } //===--===// diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp index 6bf7caa50a12..8ed31b6668e0 100644 --- a/llvm/lib/IR/SafepointIRVerifier.cpp +++ b/llvm/lib/IR/SafepointIRVerifier.cpp @@ -561,8 +561,7 @@ GCPtrTracker::GCPtrTracker(const Function &F, const DominatorTree &DT, } BasicBlockState *GCPtrTracker::getBasicBlockState(const BasicBlock *BB) { - auto it = BlockMap.find(BB); - return it != BlockMap.end() ? it->second : nullptr; + return BlockMap.lookup(BB); } const BasicBlockState *GCPtrTracker::getBasicBlockState( ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 331c28f - [ARM] Declare Op within an if statement (NFC)
Author: Kazu Hirata Date: 2020-12-30T17:45:36-08:00 New Revision: 331c28f60dbbb09136c2e86e8a4ed8d066f2d271 URL: https://github.com/llvm/llvm-project/commit/331c28f60dbbb09136c2e86e8a4ed8d066f2d271 DIFF: https://github.com/llvm/llvm-project/commit/331c28f60dbbb09136c2e86e8a4ed8d066f2d271.diff LOG: [ARM] Declare Op within an if statement (NFC) Added: Modified: llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp Removed: diff --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp index f36b34115703..b33e98e8f1ca 100644 --- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp +++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp @@ -939,11 +939,10 @@ bool MVEGatherScatterLowering::optimiseOffsets(Value *Offsets, BasicBlock *BB, return false; // The phi must be an induction variable - Instruction *Op; int IncrementingBlock = -1; for (int i = 0; i < 2; i++) -if ((Op = dyn_cast(Phi->getIncomingValue(i))) != nullptr) +if (auto *Op = dyn_cast(Phi->getIncomingValue(i))) if (Op->getOpcode() == Instruction::Add && (Op->getOperand(0) == Phi || Op->getOperand(1) == Phi)) IncrementingBlock = i; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 95ea865 - [PGO] Use isa instead of dyn_cast (NFC)
Author: Kazu Hirata Date: 2020-12-30T17:45:38-08:00 New Revision: 95ea86587c54240b3f1b7ed5a18d2f3660cb7573 URL: https://github.com/llvm/llvm-project/commit/95ea86587c54240b3f1b7ed5a18d2f3660cb7573 DIFF: https://github.com/llvm/llvm-project/commit/95ea86587c54240b3f1b7ed5a18d2f3660cb7573.diff LOG: [PGO] Use isa instead of dyn_cast (NFC) Added: Modified: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp Removed: diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 480de5483358..9efc7d1ac500 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -269,7 +269,7 @@ class PGOCounterPromoter { // FIXME: add other heuristics to detect long running loops. if (SkipRetExitBlock) { for (auto BB : ExitBlocks) -if (dyn_cast(BB->getTerminator()) != nullptr) +if (isa(BB->getTerminator())) return false; } diff --git a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp index 7acbdb9f55b7..55a93b6152dc 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp @@ -254,7 +254,7 @@ class MemOPSizeOpt : public InstVisitor { LibFunc Func; if (TLI.getLibFunc(CI, Func) && (Func == LibFunc_memcmp || Func == LibFunc_bcmp) && -!dyn_cast(CI.getArgOperand(2))) { +!isa(CI.getArgOperand(2))) { WorkList.push_back(MemOp(&CI)); } } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a87c700 - [Analysis] Remove unused code recursivelySimplifyInstruction (NFC)
Author: Kazu Hirata Date: 2020-12-30T17:45:40-08:00 New Revision: a87c7003ac260424092e5ee8bcb0059e39cd2db0 URL: https://github.com/llvm/llvm-project/commit/a87c7003ac260424092e5ee8bcb0059e39cd2db0 DIFF: https://github.com/llvm/llvm-project/commit/a87c7003ac260424092e5ee8bcb0059e39cd2db0.diff LOG: [Analysis] Remove unused code recursivelySimplifyInstruction (NFC) The last use of the function, located in RemovePredecessorAndSimplify, was removed on Dec 25, 2020 in commit 46bea9b29714ba77010612b04ba13aff56d62e7b. The last use of RemovePredecessorAndSimplify was removed on Sep 29, 2010 in commit 99c985c37dd45dd0fbd03863037d8e93153783e6. Added: Modified: llvm/include/llvm/Analysis/InstructionSimplify.h llvm/lib/Analysis/InstructionSimplify.cpp Removed: diff --git a/llvm/include/llvm/Analysis/InstructionSimplify.h b/llvm/include/llvm/Analysis/InstructionSimplify.h index a4cee8b29d9e..17d6f30a35cb 100644 --- a/llvm/include/llvm/Analysis/InstructionSimplify.h +++ b/llvm/include/llvm/Analysis/InstructionSimplify.h @@ -313,17 +313,6 @@ bool replaceAndRecursivelySimplify( const DominatorTree *DT = nullptr, AssumptionCache *AC = nullptr, SmallSetVector *UnsimplifiedUsers = nullptr); -/// Recursively attempt to simplify an instruction. -/// -/// This routine uses SimplifyInstruction to simplify 'I', and if successful -/// replaces uses of 'I' with the simplified value. It then recurses on each -/// of the users impacted. It returns true if any simplifications were -/// performed. -bool recursivelySimplifyInstruction(Instruction *I, -const TargetLibraryInfo *TLI = nullptr, -const DominatorTree *DT = nullptr, -AssumptionCache *AC = nullptr); - // These helper functions return a SimplifyQuery structure that contains as // many of the optional analysis we use as are currently valid. This is the // strongly preferred way of constructing SimplifyQuery in passes. diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 30c7ecff7940..9fed2600b3ab 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -5951,13 +5951,6 @@ static bool replaceAndRecursivelySimplifyImpl( return Simplified; } -bool llvm::recursivelySimplifyInstruction(Instruction *I, - const TargetLibraryInfo *TLI, - const DominatorTree *DT, - AssumptionCache *AC) { - return replaceAndRecursivelySimplifyImpl(I, nullptr, TLI, DT, AC, nullptr); -} - bool llvm::replaceAndRecursivelySimplify( Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI, const DominatorTree *DT, AssumptionCache *AC, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f904b46 - [llvm-objcopy] Use llvm::erase_if (NFC)
Author: Kazu Hirata Date: 2020-12-31T09:39:09-08:00 New Revision: f904b46b1a965013a51854fafbb63763617e33b3 URL: https://github.com/llvm/llvm-project/commit/f904b46b1a965013a51854fafbb63763617e33b3 DIFF: https://github.com/llvm/llvm-project/commit/f904b46b1a965013a51854fafbb63763617e33b3.diff LOG: [llvm-objcopy] Use llvm::erase_if (NFC) Added: Modified: llvm/tools/llvm-objcopy/COFF/Object.cpp Removed: diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp index cf3afe5e545e..a706000c0df4 100644 --- a/llvm/tools/llvm-objcopy/COFF/Object.cpp +++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp @@ -99,31 +99,24 @@ void Object::removeSections(function_ref ToRemove) { }; do { DenseSet RemovedSections; -Sections.erase( -std::remove_if(std::begin(Sections), std::end(Sections), - [ToRemove, &RemovedSections](const Section &Sec) { - bool Remove = ToRemove(Sec); - if (Remove) - RemovedSections.insert(Sec.UniqueId); - return Remove; - }), -std::end(Sections)); +llvm::erase_if(Sections, [ToRemove, &RemovedSections](const Section &Sec) { + bool Remove = ToRemove(Sec); + if (Remove) +RemovedSections.insert(Sec.UniqueId); + return Remove; +}); // Remove all symbols referring to the removed sections. AssociatedSections.clear(); -Symbols.erase( -std::remove_if( -std::begin(Symbols), std::end(Symbols), -[&RemovedSections, &AssociatedSections](const Symbol &Sym) { - // If there are sections that are associative to a removed - // section, - // remove those as well as nothing will include them (and we can't - // leave them dangling). - if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == - 1) -AssociatedSections.insert(Sym.TargetSectionId); - return RemovedSections.count(Sym.TargetSectionId) == 1; -}), -std::end(Symbols)); +llvm::erase_if( +Symbols, [&RemovedSections, &AssociatedSections](const Symbol &Sym) { + // If there are sections that are associative to a removed + // section, + // remove those as well as nothing will include them (and we can't + // leave them dangling). + if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1) +AssociatedSections.insert(Sym.TargetSectionId); + return RemovedSections.count(Sym.TargetSectionId) == 1; +}); ToRemove = RemoveAssociated; } while (!AssociatedSections.empty()); updateSections(); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 7bc76fd - [CodeGen] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2020-12-31T09:39:11-08:00 New Revision: 7bc76fd0ec40ae20b6d456e2d6e7c328615ed718 URL: https://github.com/llvm/llvm-project/commit/7bc76fd0ec40ae20b6d456e2d6e7c328615ed718 DIFF: https://github.com/llvm/llvm-project/commit/7bc76fd0ec40ae20b6d456e2d6e7c328615ed718.diff LOG: [CodeGen] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/IfConversion.cpp llvm/lib/CodeGen/MachineBlockPlacement.cpp llvm/lib/CodeGen/MachineSink.cpp llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp llvm/lib/CodeGen/ReachingDefAnalysis.cpp llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/lib/CodeGen/SjLjEHPrepare.cpp llvm/lib/CodeGen/TailDuplicator.cpp llvm/lib/CodeGen/WasmEHPrepare.cpp Removed: diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 3ea758a48bad..4a82c9570cc2 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -562,7 +562,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) { // are removed. SmallSetVector WorkList; for (BasicBlock &BB : F) { - SmallVector Successors(succ_begin(&BB), succ_end(&BB)); + SmallVector Successors(successors(&BB)); MadeChange |= ConstantFoldTerminator(&BB, true); if (!MadeChange) continue; @@ -576,7 +576,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) { MadeChange |= !WorkList.empty(); while (!WorkList.empty()) { BasicBlock *BB = WorkList.pop_back_val(); - SmallVector Successors(succ_begin(BB), succ_end(BB)); + SmallVector Successors(successors(BB)); DeleteDeadBlock(BB); @@ -5328,7 +5328,7 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst, if (MemoryInst->getParent() != GEP->getParent()) return false; -SmallVector Ops(GEP->op_begin(), GEP->op_end()); +SmallVector Ops(GEP->operands()); bool RewriteGEP = false; diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index d149f8c3a139..37be2eabf5fe 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -2264,8 +2264,7 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI, bool AddEdges) { if (ToBBI.IsBrAnalyzable) ToBBI.BB->normalizeSuccProbs(); - SmallVector FromSuccs(FromMBB.succ_begin(), -FromMBB.succ_end()); + SmallVector FromSuccs(FromMBB.successors()); MachineBasicBlock *NBB = getNextBlock(FromMBB); MachineBasicBlock *FallThrough = FromBBI.HasFallThrough ? NBB : nullptr; // The edge probability from ToBBI.BB to FromMBB, which is only needed when diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 8850dab30fa5..048baa460e49 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -3160,8 +3160,8 @@ void MachineBlockPlacement::findDuplicateCandidates( MachineBasicBlock *Fallthrough = nullptr; BranchProbability DefaultBranchProb = BranchProbability::getZero(); BlockFrequency BBDupThreshold(scaleThreshold(BB)); - SmallVector Preds(BB->pred_begin(), BB->pred_end()); - SmallVector Succs(BB->succ_begin(), BB->succ_end()); + SmallVector Preds(BB->predecessors()); + SmallVector Succs(BB->successors()); // Sort for highest frequency. auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) { diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 265ca6dcb894..48ed8b0c5e73 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -745,8 +745,7 @@ MachineSinking::GetAllSortedSuccessors(MachineInstr &MI, MachineBasicBlock *MBB, if (Succs != AllSuccessors.end()) return Succs->second; - SmallVector AllSuccs(MBB->succ_begin(), - MBB->succ_end()); + SmallVector AllSuccs(MBB->successors()); // Handle cases where sinking can happen but where the sink point isn't a // successor. For example: diff --git a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp index 1be9544848ec..80c38f3ec341 100644 --- a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp +++ b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp @@ -96,7 +96,7 @@ static bool lowerObjCCall(Function &F, const char *NewFn, ++I; IRBuilder<> Builder(CI->getParent(), CI->getIterator()); -SmallVector Args(CI->arg_begin(), CI->arg_end()); +SmallVector Args(CI->args()); CallInst *NewCI = Builder.CreateCall(FCache, Args); NewCI->setName(CI->getName()); diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp index 2f0a622d3846..d16e90a7e
[llvm-branch-commits] [llvm] b557c32 - [MemorySSA, BPF] Use isa instead of dyn_cast (NFC)
Author: Kazu Hirata Date: 2020-12-31T09:39:13-08:00 New Revision: b557c32ae925e0aa39d40e0254380953aad1c78f URL: https://github.com/llvm/llvm-project/commit/b557c32ae925e0aa39d40e0254380953aad1c78f DIFF: https://github.com/llvm/llvm-project/commit/b557c32ae925e0aa39d40e0254380953aad1c78f.diff LOG: [MemorySSA, BPF] Use isa instead of dyn_cast (NFC) Added: Modified: llvm/lib/Analysis/MemorySSA.cpp llvm/lib/Target/BPF/BPFAdjustOpt.cpp Removed: diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index c9ad9ffab16e..e728a5f998f4 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1779,8 +1779,8 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I, bool Def, Use; if (Template) { -Def = dyn_cast_or_null(Template) != nullptr; -Use = dyn_cast_or_null(Template) != nullptr; +Def = isa(Template); +Use = isa(Template); #if !defined(NDEBUG) ModRefInfo ModRef = AAP->getModRefInfo(I, None); bool DefCheck, UseCheck; diff --git a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp index 6afd2d77485d..928b591b2274 100644 --- a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp +++ b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp @@ -221,7 +221,7 @@ bool BPFAdjustOptImpl::avoidSpeculation(Instruction &I) { } } - if (!dyn_cast(&I) && !dyn_cast(&I)) + if (!isa(&I) && !isa(&I)) return false; // For: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f43daf1 - [SSAUpdater] Remove unused code InstrIsPHI (NFC)
Author: Kazu Hirata Date: 2021-01-01T12:44:52-08:00 New Revision: f43daf1b62af25d066893af02b4f67b9b8dd524e URL: https://github.com/llvm/llvm-project/commit/f43daf1b62af25d066893af02b4f67b9b8dd524e DIFF: https://github.com/llvm/llvm-project/commit/f43daf1b62af25d066893af02b4f67b9b8dd524e.diff LOG: [SSAUpdater] Remove unused code InstrIsPHI (NFC) The last use of this function was removed on Jan 4, 2018 in commit commit 90ecac01e9dcbcaf92781a6dcffa07a27191b661. Added: Modified: llvm/lib/Transforms/Utils/SSAUpdater.cpp Removed: diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp index c3add49a7ccd..a80d577e29fb 100644 --- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp +++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp @@ -282,12 +282,6 @@ class SSAUpdaterTraits { PHI->addIncoming(Val, Pred); } - /// InstrIsPHI - Check if an instruction is a PHI. - /// - static PHINode *InstrIsPHI(Instruction *I) { -return dyn_cast(I); - } - /// ValueIsPHI - Check if a value is a PHI. static PHINode *ValueIsPHI(Value *Val, SSAUpdater *Updater) { return dyn_cast(Val); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] bea8d02 - [llvm] Use *Map::lookup (NFC)
Author: Kazu Hirata Date: 2021-01-01T12:44:54-08:00 New Revision: bea8d021a32d871f43909f892c8069137fb34bfa URL: https://github.com/llvm/llvm-project/commit/bea8d021a32d871f43909f892c8069137fb34bfa DIFF: https://github.com/llvm/llvm-project/commit/bea8d021a32d871f43909f892c8069137fb34bfa.diff LOG: [llvm] Use *Map::lookup (NFC) Added: Modified: llvm/include/llvm/ProfileData/SampleProf.h llvm/lib/Support/CommandLine.cpp llvm/tools/llvm-objcopy/COFF/Object.cpp llvm/utils/TableGen/CodeGenRegisters.cpp llvm/utils/TableGen/CodeGenTarget.cpp llvm/utils/TableGen/GlobalISel/GIMatchTree.h Removed: diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index 5d503f2d2d72..c423466fe75b 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -796,10 +796,7 @@ class FunctionSamples { return Name; assert(GUIDToFuncNameMap && "GUIDToFuncNameMap needs to be popluated first"); -auto iter = GUIDToFuncNameMap->find(std::stoull(Name.data())); -if (iter == GUIDToFuncNameMap->end()) - return StringRef(); -return iter->second; +return GUIDToFuncNameMap->lookup(std::stoull(Name.data())); } /// Returns the line offset to the start line of the subprogram. diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 1b9436d56fdb..c8578f9ce32c 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -531,11 +531,7 @@ Option *CommandLineParser::LookupOption(SubCommand &Sub, StringRef &Arg, // If we have an equals sign, remember the value. if (EqualPos == StringRef::npos) { // Look up the option. -auto I = Sub.OptionsMap.find(Arg); -if (I == Sub.OptionsMap.end()) - return nullptr; - -return I != Sub.OptionsMap.end() ? I->second : nullptr; +return Sub.OptionsMap.lookup(Arg); } // If the argument before the = is a valid option name and the option allows diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp index a706000c0df4..acb1d2524f42 100644 --- a/llvm/tools/llvm-objcopy/COFF/Object.cpp +++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp @@ -31,10 +31,7 @@ void Object::updateSymbols() { } const Symbol *Object::findSymbol(size_t UniqueId) const { - auto It = SymbolMap.find(UniqueId); - if (It == SymbolMap.end()) -return nullptr; - return It->second; + return SymbolMap.lookup(UniqueId); } Error Object::removeSymbols( @@ -86,10 +83,7 @@ void Object::updateSections() { } const Section *Object::findSection(ssize_t UniqueId) const { - auto It = SectionMap.find(UniqueId); - if (It == SectionMap.end()) -return nullptr; - return It->second; + return SectionMap.lookup(UniqueId); } void Object::removeSections(function_ref ToRemove) { diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index a24691589cee..f520c1dbc5d2 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -1238,8 +1238,7 @@ CodeGenSubRegIndex *CodeGenRegBank::getSubRegIdx(Record *Def) { const CodeGenSubRegIndex * CodeGenRegBank::findSubRegIdx(const Record* Def) const { - auto I = Def2SubRegIdx.find(Def); - return (I == Def2SubRegIdx.end()) ? nullptr : I->second; + return Def2SubRegIdx.lookup(Def); } CodeGenRegister *CodeGenRegBank::getReg(Record *Def) { diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index d31405af1c7b..2cfcd1820cc1 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -393,11 +393,7 @@ void CodeGenTarget::ReadRegAltNameIndices() const { /// getRegisterByName - If there is a register with the specific AsmName, /// return it. const CodeGenRegister *CodeGenTarget::getRegisterByName(StringRef Name) const { - const StringMap &Regs = getRegBank().getRegistersByName(); - StringMap::const_iterator I = Regs.find(Name); - if (I == Regs.end()) -return nullptr; - return I->second; + return getRegBank().getRegistersByName().lookup(Name); } std::vector CodeGenTarget::getRegisterVTs(Record *R) diff --git a/llvm/utils/TableGen/GlobalISel/GIMatchTree.h b/llvm/utils/TableGen/GlobalISel/GIMatchTree.h index b86f6454589c..bf41a2e0e234 100644 --- a/llvm/utils/TableGen/GlobalISel/GIMatchTree.h +++ b/llvm/utils/TableGen/GlobalISel/GIMatchTree.h @@ -353,10 +353,7 @@ class GIMatchTreeBuilderLeafInfo { void declareOperand(unsigned InstrID, unsigned OpIdx); GIMatchTreeInstrInfo *getInstrInfo(unsigned ID) const { -auto I = InstrIDToInfo.find(ID); -if (I != InstrIDToInfo.end()) - return I->second; -return nullptr; +return InstrIDToInfo.lookup(ID); } void dump(raw_ostream &OS) const { _
[llvm-branch-commits] [llvm] 9a90c4e - [llvm] Use isa instead of dyn_cast (NFC)
Author: Kazu Hirata Date: 2021-01-01T12:44:56-08:00 New Revision: 9a90c4ea8a05959a08109cb876397447d7cd9c2d URL: https://github.com/llvm/llvm-project/commit/9a90c4ea8a05959a08109cb876397447d7cd9c2d DIFF: https://github.com/llvm/llvm-project/commit/9a90c4ea8a05959a08109cb876397447d7cd9c2d.diff LOG: [llvm] Use isa instead of dyn_cast (NFC) Added: Modified: llvm/tools/llvm-nm/llvm-nm.cpp llvm/utils/TableGen/FixedLenDecoderEmitter.cpp Removed: diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index d9dc1f1b419c..bbbf90db26f5 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -1095,9 +1095,8 @@ static char getSymbolNMTypeChar(IRObjectFile &Obj, basic_symbol_iterator I) { } static bool isObject(SymbolicFile &Obj, basic_symbol_iterator I) { - return !dyn_cast(&Obj) - ? false - : elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT; + return isa(&Obj) && + elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT; } // For ELF object files, Set TypeName to the symbol typename, to be printed diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index ca071fb79901..6a7db45c6bde 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -1193,7 +1193,7 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation, if (!Pred->getValue("AssemblerMatcherPredicate")) continue; -if (!dyn_cast(Pred->getValue("AssemblerCondDag")->getValue())) +if (!isa(Pred->getValue("AssemblerCondDag")->getValue())) continue; const DagInit *D = Pred->getValueAsDag("AssemblerCondDag"); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] f7f42e6 - [TableGen] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:13-08:00 New Revision: f7f42e64dfa287479e97fb0ddd3212b953622819 URL: https://github.com/llvm/llvm-project/commit/f7f42e64dfa287479e97fb0ddd3212b953622819 DIFF: https://github.com/llvm/llvm-project/commit/f7f42e64dfa287479e97fb0ddd3212b953622819.diff LOG: [TableGen] Use llvm::append_range (NFC) Added: Modified: llvm/utils/TableGen/CodeGenDAGPatterns.cpp llvm/utils/TableGen/CodeGenSchedule.cpp llvm/utils/TableGen/CodeGenTarget.cpp llvm/utils/TableGen/FixedLenDecoderEmitter.cpp llvm/utils/TableGen/RegisterInfoEmitter.cpp llvm/utils/TableGen/SubtargetEmitter.cpp llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp Removed: diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index e098f632c80af..6b6e1ec7b04d2 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -4293,7 +4293,7 @@ void CodeGenDAGPatterns::ExpandHwModeBasedTypes() { std::vector Preds = P.Predicates; const std::vector &MC = ModeChecks[Mode]; -Preds.insert(Preds.end(), MC.begin(), MC.end()); +llvm::append_range(Preds, MC); PatternsToMatch.emplace_back(P.getSrcRecord(), Preds, std::move(NewSrc), std::move(NewDst), P.getDstRegs(), P.getAddedComplexity(), Record::getNewUID(), diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 8b54ff0d1d72b..3210a60d9de26 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -1549,8 +1549,7 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { ExpandedRWs.push_back(*RWI); else SchedModels.expandRWSequence(*RWI, ExpandedRWs, IsRead); - RWSequences[OperIdx].insert(RWSequences[OperIdx].end(), - ExpandedRWs.begin(), ExpandedRWs.end()); + llvm::append_range(RWSequences[OperIdx], ExpandedRWs); } assert(OperIdx == RWSequences.size() && "missed a sequence"); } @@ -1566,7 +1565,7 @@ pushVariant(const TransVariant &VInfo, bool IsRead) { else SchedModels.expandRWSequence(*RWI, ExpandedRWs, IsRead); } -Seq.insert(Seq.end(), ExpandedRWs.begin(), ExpandedRWs.end()); +llvm::append_range(Seq, ExpandedRWs); } } @@ -1826,8 +1825,7 @@ void CodeGenSchedModels::verifyProcResourceGroups(CodeGenProcModel &PM) { OtherUnits.begin(), OtherUnits.end()) != CheckUnits.end()) { // CheckUnits and OtherUnits overlap -OtherUnits.insert(OtherUnits.end(), CheckUnits.begin(), - CheckUnits.end()); +llvm::append_range(OtherUnits, CheckUnits); if (!hasSuperGroup(OtherUnits, PM)) { PrintFatalError((PM.ProcResourceDefs[i])->getLoc(), "proc resource group overlaps with " diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 2cfcd1820cc1d..37bce3afa05a9 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -403,7 +403,7 @@ std::vector CodeGenTarget::getRegisterVTs(Record *R) for (const auto &RC : getRegBank().getRegClasses()) { if (RC.contains(Reg)) { ArrayRef InVTs = RC.getValueTypes(); - Result.insert(Result.end(), InVTs.begin(), InVTs.end()); + llvm::append_range(Result, InVTs); } } @@ -416,7 +416,7 @@ std::vector CodeGenTarget::getRegisterVTs(Record *R) void CodeGenTarget::ReadLegalValueTypes() const { for (const auto &RC : getRegBank().getRegClasses()) -LegalValueTypes.insert(LegalValueTypes.end(), RC.VTs.begin(), RC.VTs.end()); +llvm::append_range(LegalValueTypes, RC.VTs); // Remove duplicates. llvm::sort(LegalValueTypes); diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 6a7db45c6bde9..4f1f559f99f0e 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -722,7 +722,7 @@ void Filter::emitTableEntry(DecoderTableInfo &TableInfo) const { assert(TableInfo.FixupStack.size() > 1 && "fixup stack underflow!"); FixupScopeList::iterator Source = TableInfo.FixupStack.end() - 1; FixupScopeList::iterator Dest = Source - 1; - Dest->insert(Dest->end(), Source->begin(), Source->end()); + llvm::append_range(*Dest, *Source); TableInfo.FixupStack.pop_back(); // If there is no fallthrough, then the final filter should get fixed @@ -2010,9 +2010,8 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef, // For each operand, see if we can figure out where it is encoded. for (const auto &Op : InOutOperands) { if (!NumberedInsnOperands[s
[llvm-branch-commits] [llvm] 171c5fd - [llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:15-08:00 New Revision: 171c5fd43ecf46d5798b402c8cafccab07060e10 URL: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10 DIFF: https://github.com/llvm/llvm-project/commit/171c5fd43ecf46d5798b402c8cafccab07060e10.diff LOG: [llvm] Use llvm::erase_value and llvm::erase_if (NFC) Added: Modified: llvm/lib/CodeGen/WinEHPrepare.cpp llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp Removed: diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 5a25234ba850..96d256ba57a3 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -804,13 +804,9 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) { << "\' to block \'" << NewBlock->getName() << "\'.\n"); - BlocksInFunclet.erase( - std::remove(BlocksInFunclet.begin(), BlocksInFunclet.end(), OldBlock), - BlocksInFunclet.end()); + llvm::erase_value(BlocksInFunclet, OldBlock); ColorVector &OldColors = BlockColors[OldBlock]; - OldColors.erase( - std::remove(OldColors.begin(), OldColors.end(), FuncletPadBB), - OldColors.end()); + llvm::erase_value(OldColors, FuncletPadBB); DEBUG_WITH_TYPE("winehprepare-coloring", dbgs() << " Removed color \'" << FuncletPadBB->getName() diff --git a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp index 39945ac3b1c1..b6763fd9aef0 100644 --- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -997,7 +997,7 @@ OperandMatchResultTy HexagonAsmParser::tryParseRegister(unsigned &RegNo, NeededWorkaround = NeededWorkaround || (Again && !(Contigious && Type)); } std::string Collapsed = std::string(RawString); - Collapsed.erase(llvm::remove_if(Collapsed, isSpace), Collapsed.end()); + llvm::erase_if(Collapsed, isSpace); StringRef FullString = Collapsed; std::pair DotSplit = FullString.split('.'); unsigned DotReg = matchRegister(DotSplit.first.lower()); diff --git a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp index 3f50d60bc12c..7ffc75e66a52 100644 --- a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp +++ b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp @@ -39,7 +39,7 @@ inline bool isNumericRegex(llvm::StringRef S) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { std::string Input(reinterpret_cast(Data), Size); - Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end()); + llvm::erase_value(Input, 0); if (!Input.empty() && llvm::yaml::isNumeric(Input) != isNumericRegex(Input)) LLVM_BUILTIN_TRAP; return 0; diff --git a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp index 3aeaf02f3e75..007769fd047a 100644 --- a/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp +++ b/llvm/tools/llvm-yaml-parser-fuzzer/yaml-parser-fuzzer.cpp @@ -25,7 +25,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { isValidYaml(Input.data(), Input.size()); // Ensure we don't crash on byte strings with no null characters. - Input.erase(std::remove(Input.begin(), Input.end(), 0), Input.end()); + llvm::erase_value(Input, 0); Input.shrink_to_fit(); bool IsValidWithout0s = isValidYaml(Input.data(), Input.size()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 530c5af - [Transforms] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-02T09:24:17-08:00 New Revision: 530c5af6a4810b54b6a82e4cbf0575ac67722cc9 URL: https://github.com/llvm/llvm-project/commit/530c5af6a4810b54b6a82e4cbf0575ac67722cc9 DIFF: https://github.com/llvm/llvm-project/commit/530c5af6a4810b54b6a82e4cbf0575ac67722cc9.diff LOG: [Transforms] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/IPO/GlobalOpt.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/LoopFuse.cpp llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp Removed: diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index c67d69a52fd2a..9c3c10660bd0f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1522,7 +1522,7 @@ static void rewritePHIs(BasicBlock &BB) { // so we need to create an additional "dispatcher" block. if (auto *CleanupPad = dyn_cast_or_null(BB.getFirstNonPHI())) { -SmallVector Preds(pred_begin(&BB), pred_end(&BB)); +SmallVector Preds(predecessors(&BB)); for (BasicBlock *Pred : Preds) { if (CatchSwitchInst *CS = dyn_cast(Pred->getTerminator())) { @@ -1548,7 +1548,7 @@ static void rewritePHIs(BasicBlock &BB) { // ehAwareSplitEdge cloned it in the transition blocks. } - SmallVector Preds(pred_begin(&BB), pred_end(&BB)); + SmallVector Preds(predecessors(&BB)); for (BasicBlock *Pred : Preds) { auto *IncomingBB = ehAwareSplitEdge(Pred, &BB, LandingPad, ReplPHI); IncomingBB->setName(BB.getName() + Twine(".from.") + Pred->getName()); diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 96a27d83bb54c..b0a2194052f30 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -286,7 +286,7 @@ static bool CleanupConstantGlobalUsers( // we delete a constant array, we may also be holding pointer to one of its // elements (or an element of one of its elements if we're dealing with an // array of arrays) in the worklist. - SmallVector WorkList(V->user_begin(), V->user_end()); + SmallVector WorkList(V->users()); while (!WorkList.empty()) { Value *UV = WorkList.pop_back_val(); if (!UV) diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 5d8abe14327bb..f63859fbdde05 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1816,7 +1816,7 @@ static Instruction *foldSelectGEP(GetElementPtrInst &GEP, // gep (select Cond, TrueC, FalseC), IndexC --> select Cond, TrueC', FalseC' // Propagate 'inbounds' and metadata from existing instructions. // Note: using IRBuilder to create the constants for efficiency. - SmallVector IndexC(GEP.idx_begin(), GEP.idx_end()); + SmallVector IndexC(GEP.indices()); bool IsInBounds = GEP.isInBounds(); Value *NewTrueC = IsInBounds ? Builder.CreateInBoundsGEP(TrueC, IndexC) : Builder.CreateGEP(TrueC, IndexC); @@ -1826,7 +1826,7 @@ static Instruction *foldSelectGEP(GetElementPtrInst &GEP, } Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) { - SmallVector Ops(GEP.op_begin(), GEP.op_end()); + SmallVector Ops(GEP.operands()); Type *GEPType = GEP.getType(); Type *GEPEltType = GEP.getSourceElementType(); bool IsGEPSrcEleScalable = isa(GEPEltType); @@ -2232,7 +2232,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) { // -> // %0 = GEP [10 x i8] addrspace(1)* X, ... // addrspacecast i8 addrspace(1)* %0 to i8* -SmallVector Idx(GEP.idx_begin(), GEP.idx_end()); +SmallVector Idx(GEP.indices()); Value *NewGEP = GEP.isInBounds() ? Builder.CreateInBoundsGEP(StrippedPtrEltTy, StrippedPtr, diff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp index 4d63ed90096cc..b5f8dfa9aafbb 100644 --- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp @@ -1474,8 +1474,7 @@ struct LoopFuser { mergeLatch(FC0, FC1); // Merge the loops. -SmallVector Blocks(FC1.L->block_begin(), -FC1.L->block_end()); +SmallVector Blocks(FC1.L->blocks()); for (BasicBlock *BB : Blocks) { FC0.L->addBlockEntry(BB); FC1.L->removeBlockFromLoop(BB); @@ -1765,8 +1764,7 @@ struct LoopFuser { mergeLatch(FC0, FC1); // Merge the loops. -SmallVector Blocks(FC1.L->block_begin()
[llvm-branch-commits] [llvm] 985f899 - [Target] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-03T09:57:43-08:00 New Revision: 985f899bf2cc70aeb383a46c6a84aa634677bca2 URL: https://github.com/llvm/llvm-project/commit/985f899bf2cc70aeb383a46c6a84aa634677bca2 DIFF: https://github.com/llvm/llvm-project/commit/985f899bf2cc70aeb383a46c6a84aa634677bca2.diff LOG: [Target] Use llvm::append_range (NFC) Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp llvm/lib/Target/AMDGPU/R600MachineScheduler.cpp llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp llvm/lib/Target/BPF/BPFAdjustOpt.cpp llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Target/X86/X86InstrInfo.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp index 9ea8b3265b0d..7232548bbb85 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp @@ -392,8 +392,7 @@ bool AMDGPUUnifyDivergentExitNodes::runOnFunction(Function &F) { // uniformly reached block with the "done" bit cleared. auto BlocksToUnify = std::move(ReturningBlocks); if (InsertExport) { -BlocksToUnify.insert(BlocksToUnify.end(), UniformlyReachedRetBlocks.begin(), - UniformlyReachedRetBlocks.end()); +llvm::append_range(BlocksToUnify, UniformlyReachedRetBlocks); } unifyReturnBlockSet(F, DTU, BlocksToUnify, InsertExport, TTI, diff --git a/llvm/lib/Target/AMDGPU/R600MachineScheduler.cpp b/llvm/lib/Target/AMDGPU/R600MachineScheduler.cpp index d7d53c644f33..7382c2f076e4 100644 --- a/llvm/lib/Target/AMDGPU/R600MachineScheduler.cpp +++ b/llvm/lib/Target/AMDGPU/R600MachineScheduler.cpp @@ -45,7 +45,7 @@ void R600SchedStrategy::initialize(ScheduleDAGMI *dag) { void R600SchedStrategy::MoveUnits(std::vector &QSrc, std::vector &QDst) { - QDst.insert(QDst.end(), QSrc.begin(), QSrc.end()); + llvm::append_range(QDst, QSrc); QSrc.clear(); } diff --git a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp index a8b607618946..ee119ff71e96 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp @@ -763,8 +763,7 @@ void SIScheduleBlockCreator::colorHighLatenciesGroups() { // depend (order dependency) on one of the // instruction in the block, and are required for the // high latency instruction we add. - AdditionalElements.insert(AdditionalElements.end(), -SubGraph.begin(), SubGraph.end()); + llvm::append_range(AdditionalElements, SubGraph); } } if (CompatibleGroup) { diff --git a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp index 928b591b2274..da543e7eba53 100644 --- a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp +++ b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp @@ -301,7 +301,7 @@ bool BPFAdjustOptImpl::avoidSpeculation(Instruction &I) { if (!isCandidate || Candidates.empty()) return false; - PassThroughs.insert(PassThroughs.end(), Candidates.begin(), Candidates.end()); + llvm::append_range(PassThroughs, Candidates); return true; } diff --git a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp index 04cd432f56c5..11e7d5a17fa9 100644 --- a/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp +++ b/llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp @@ -447,7 +447,7 @@ static void nodes_for_root(GepNode *Root, NodeChildrenMap &NCM, Work.erase(First); NodeChildrenMap::iterator CF = NCM.find(N); if (CF != NCM.end()) { -Work.insert(Work.end(), CF->second.begin(), CF->second.end()); +llvm::append_range(Work, CF->second); Nodes.insert(CF->second.begin(), CF->second.end()); } } @@ -1145,7 +1145,7 @@ void HexagonCommonGEP::getAllUsersForNode(GepNode *Node, ValueVect &Values, NodeChildrenMap::iterator CF = NCM.find(N); if (CF != NCM.end()) { NodeVect &Cs = CF->second; - Work.insert(Work.end(), Cs.begin(), Cs.end()); + llvm::append_range(Work, Cs); } } } diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp index 52b0a1a58c19..056a5a83a0a6 100644 --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp @@ -585,7 +585,7 @@ auto AlignVectors::createLoadGroups(const AddrList &Group) const -> MoveList { if (llvm::any_of(Deps, inAddrMap)) return false; Move.Main.push_back(Info.Inst); -Move.Deps.insert(Move.Deps.end(), Deps.begin(), Deps.end()); +llvm::append_range(Move.Deps, Deps);
[llvm-branch-commits] [llvm] 0e219b6 - [Target] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-03T09:57:45-08:00 New Revision: 0e219b6443b2a1359cf0096e96b1e74eb60613fc URL: https://github.com/llvm/llvm-project/commit/0e219b6443b2a1359cf0096e96b1e74eb60613fc DIFF: https://github.com/llvm/llvm-project/commit/0e219b6443b2a1359cf0096e96b1e74eb60613fc.diff LOG: [Target] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp llvm/lib/Target/ARM/ARMISelLowering.cpp llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp Removed: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp index b7862f6ef9a4..033fdc7b0886 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp @@ -920,7 +920,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC, IC.Builder.SetInsertPoint(&II); // Assume the arguments are unchanged and later override them, if needed. - SmallVector Args(II.arg_begin(), II.arg_end()); + SmallVector Args(II.args()); if (DMaskIdx < 0) { // Buffer case. diff --git a/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp b/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp index d6c151d3d2cc..46ee2eb2ed0f 100644 --- a/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp +++ b/llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp @@ -364,8 +364,7 @@ bool searchPredecessors(const MachineBasicBlock *MBB, return false; DenseSet Visited; - SmallVector Worklist(MBB->pred_begin(), - MBB->pred_end()); + SmallVector Worklist(MBB->predecessors()); while (!Worklist.empty()) { MachineBasicBlock *MBB = Worklist.pop_back_val(); diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index c7abc585d0d1..ea22e0fa16ab 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -6001,8 +6001,8 @@ SDValue SITargetLowering::lowerImage(SDValue Op, unsigned IntrOpcode = Intr->BaseOpcode; bool IsGFX10Plus = AMDGPU::isGFX10Plus(*Subtarget); - SmallVector ResultTypes(Op->value_begin(), Op->value_end()); - SmallVector OrigResultTypes(Op->value_begin(), Op->value_end()); + SmallVector ResultTypes(Op->values()); + SmallVector OrigResultTypes(Op->values()); bool IsD16 = false; bool IsG16 = false; bool IsA16 = false; diff --git a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp index 563a52f997dd..6366fcff6637 100644 --- a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp @@ -181,8 +181,7 @@ char &llvm::SILowerControlFlowID = SILowerControlFlow::ID; static bool hasKill(const MachineBasicBlock *Begin, const MachineBasicBlock *End, const SIInstrInfo *TII) { DenseSet Visited; - SmallVector Worklist(Begin->succ_begin(), - Begin->succ_end()); + SmallVector Worklist(Begin->successors()); while (!Worklist.empty()) { MachineBasicBlock *MBB = Worklist.pop_back_val(); diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index a50bb623092a..6eb1bdffdac4 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -10401,8 +10401,7 @@ void ARMTargetLowering::EmitSjLjDispatchBlock(MachineInstr &MI, // Remove the landing pad successor from the invoke block and replace it // with the new dispatch block. -SmallVector Successors(BB->succ_begin(), - BB->succ_end()); +SmallVector Successors(BB->successors()); while (!Successors.empty()) { MachineBasicBlock *SMBB = Successors.pop_back_val(); if (SMBB->isEHPad()) { diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp index b556af84f140..0dc0afe271d1 100644 --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -2000,8 +2000,7 @@ void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE, return; } - SmallVector Operands(I.value_op_begin(), -I.value_op_end()); + SmallVector Operands(I.operand_values()); Cost += getUserCost(&I, Operands, TargetTransformInfo::TCK_SizeAndLatency); } diff --git a/llvm/lib/
[llvm-branch-commits] [llvm] ba82c0b - [llvm] Call *(Set|Map)::erase directly (NFC)
Author: Kazu Hirata Date: 2021-01-03T09:57:47-08:00 New Revision: ba82c0b3157b7397c938215b6a0582acc324c760 URL: https://github.com/llvm/llvm-project/commit/ba82c0b3157b7397c938215b6a0582acc324c760 DIFF: https://github.com/llvm/llvm-project/commit/ba82c0b3157b7397c938215b6a0582acc324c760.diff LOG: [llvm] Call *(Set|Map)::erase directly (NFC) We can erase an item in a set or map without checking its membership first. Added: Modified: llvm/lib/Analysis/AssumptionCache.cpp llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/Transforms/IPO/IROutliner.cpp llvm/lib/Transforms/Scalar/GVN.cpp llvm/lib/Transforms/Scalar/GVNSink.cpp Removed: diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp index bb1ac616ee7f..70053fdf8d30 100644 --- a/llvm/lib/Analysis/AssumptionCache.cpp +++ b/llvm/lib/Analysis/AssumptionCache.cpp @@ -167,9 +167,7 @@ void AssumptionCache::unregisterAssumption(CallInst *CI) { } void AssumptionCache::AffectedValueCallbackVH::deleted() { - auto AVI = AC->AffectedValues.find(getValPtr()); - if (AVI != AC->AffectedValues.end()) -AC->AffectedValues.erase(AVI); + AC->AffectedValues.erase(getValPtr()); // 'this' now dangles! } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 6127c503404f..b790434576cb 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -788,14 +788,9 @@ static void collectCallSiteParameters(const MachineInstr *CallMI, } // Do not emit CSInfo for undef forwarding registers. - for (auto &MO : CallMI->uses()) { -if (!MO.isReg() || !MO.isUndef()) - continue; -auto It = ForwardedRegWorklist.find(MO.getReg()); -if (It == ForwardedRegWorklist.end()) - continue; -ForwardedRegWorklist.erase(It); - } + for (auto &MO : CallMI->uses()) +if (MO.isReg() && MO.isUndef()) + ForwardedRegWorklist.erase(MO.getReg()); // We erase, from the ForwardedRegWorklist, those forwarding registers for // which we successfully describe a loaded value (by using diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index d64a8f26519f..71dbe8d44ba7 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -3160,9 +3160,7 @@ class PhiNodeSet { /// \returns whether the element is actually removed, i.e. was in the /// collection before the operation. bool erase(PHINode *Ptr) { -auto it = NodeMap.find(Ptr); -if (it != NodeMap.end()) { - NodeMap.erase(Ptr); +if (NodeMap.erase(Ptr)) { SkipRemovedElements(FirstValidElement); return true; } diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp index 01605769bcff..e506d84b2c29 100644 --- a/llvm/lib/Transforms/IPO/IROutliner.cpp +++ b/llvm/lib/Transforms/IPO/IROutliner.cpp @@ -1027,9 +1027,7 @@ alignOutputBlockWithAggFunc(OutlinableGroup &OG, OutlinableRegion &Region, // If we have found one of the stored values for output, replace the value // with the corresponding one from the overall function. -if (GVN.hasValue() && -ValuesToFind.find(GVN.getValue()) != ValuesToFind.end()) { - ValuesToFind.erase(GVN.getValue()); +if (GVN.hasValue() && ValuesToFind.erase(GVN.getValue())) { V->replaceAllUsesWith(OverallFunctionInsts[Idx]); if (ValuesToFind.size() == 0) break; diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 448ff498b110..e9cf97398a8b 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1920,11 +1920,8 @@ uint32_t GVN::ValueTable::phiTranslateImpl(const BasicBlock *Pred, /// again. void GVN::ValueTable::eraseTranslateCacheEntry(uint32_t Num, const BasicBlock &CurrBlock) { - for (const BasicBlock *Pred : predecessors(&CurrBlock)) { -auto FindRes = PhiTranslateTable.find({Num, Pred}); -if (FindRes != PhiTranslateTable.end()) - PhiTranslateTable.erase(FindRes); - } + for (const BasicBlock *Pred : predecessors(&CurrBlock)) +PhiTranslateTable.erase({Num, Pred}); } // In order to find a leader for a given value number at a diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp index 5a34ad18158b..1cc10ca4dce0 100644 --- a/llvm/lib/Transforms/Scalar/GVNSink.cpp +++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp @@ -692,10 +692,8 @@ Optional GVNSink::analyzeInstructionForSinking( ModelledPHI NewPHI(NewInsts, ActivePreds); // Does sinking this instruction render previous PHIs redundant? - if (NeededPHIs.find(NewPHI) != NeededPHIs.end()) { -NeededPHIs.erase(NewPHI); + if (NeededPHIs.e
[llvm-branch-commits] [llvm] 848e8f9 - [llvm] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-04T11:42:44-08:00 New Revision: 848e8f938fdbefc98a1e079c8a63768cfe9657ab URL: https://github.com/llvm/llvm-project/commit/848e8f938fdbefc98a1e079c8a63768cfe9657ab DIFF: https://github.com/llvm/llvm-project/commit/848e8f938fdbefc98a1e079c8a63768cfe9657ab.diff LOG: [llvm] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/include/llvm/IR/DebugInfoMetadata.h llvm/include/llvm/IR/Metadata.h llvm/include/llvm/IR/PredIteratorCache.h llvm/lib/Analysis/InstructionSimplify.cpp llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/IR/Constants.cpp llvm/lib/IR/Verifier.cpp llvm/lib/TableGen/Record.cpp Removed: diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index d9d04429b181..ee34312ccf6d 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -332,8 +332,7 @@ class TargetTransformInfo { /// This is a helper function which calls the two-argument getUserCost /// with \p Operands which are the current operands U has. int getUserCost(const User *U, TargetCostKind CostKind) const { -SmallVector Operands(U->value_op_begin(), - U->value_op_end()); +SmallVector Operands(U->operand_values()); return getUserCost(U, Operands, CostKind); } diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index ef0653d0d9f4..47de99b02d97 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -1071,8 +1071,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase { } int getInstructionLatency(const Instruction *I) { -SmallVector Operands(I->value_op_begin(), - I->value_op_end()); +SmallVector Operands(I->operand_values()); if (getUserCost(I, Operands, TTI::TCK_Latency) == TTI::TCC_Free) return 0; diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index 94b3beb4effd..20c212ca04e1 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -240,9 +240,8 @@ class GenericDINode : public DINode { StorageType Storage, bool ShouldCreate = true); TempGenericDINode cloneImpl() const { -return getTemporary( -getContext(), getTag(), getHeader(), -SmallVector(dwarf_op_begin(), dwarf_op_end())); +return getTemporary(getContext(), getTag(), getHeader(), +SmallVector(dwarf_operands())); } public: diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h index edd1d4b3b839..33b92c3c90da 100644 --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -1128,8 +1128,7 @@ class MDTuple : public MDNode { StorageType Storage, bool ShouldCreate = true); TempMDTuple cloneImpl() const { -return getTemporary(getContext(), -SmallVector(op_begin(), op_end())); +return getTemporary(getContext(), SmallVector(operands())); } public: diff --git a/llvm/include/llvm/IR/PredIteratorCache.h b/llvm/include/llvm/IR/PredIteratorCache.h index 4d8efcfa9eab..6bbd7e5e87a0 100644 --- a/llvm/include/llvm/IR/PredIteratorCache.h +++ b/llvm/include/llvm/IR/PredIteratorCache.h @@ -44,7 +44,7 @@ class PredIteratorCache { if (Entry) return Entry; -SmallVector PredCache(pred_begin(BB), pred_end(BB)); +SmallVector PredCache(predecessors(BB)); PredCache.push_back(nullptr); // null terminator. BlockToPredCountMap[BB] = PredCache.size() - 1; diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index d89a776b7908..dfaf36a96953 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3599,7 +3599,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, // expression GEP with the same indices and a null base pointer to see // what constant folding can make out of it. Constant *Null = Constant::getNullValue(GLHS->getPointerOperandType()); -SmallVector IndicesLHS(GLHS->idx_begin(), GLHS->idx_end()); +SmallVector IndicesLHS(GLHS->indices()); Constant *NewLHS = ConstantExpr::getGetElementPtr( GLHS->getSourceElementType(), Null, IndicesLHS); @@ -5814,7 +5814,7 @@ Value *llvm::SimplifyInstruction(Instruction *I, const SimplifyQuery &SQ,
[llvm-branch-commits] [llvm] eb198f4 - [llvm] Use llvm::any_of (NFC)
Author: Kazu Hirata Date: 2021-01-04T11:42:47-08:00 New Revision: eb198f4c3cedae4e9778f11e76e0fa1f1b61b622 URL: https://github.com/llvm/llvm-project/commit/eb198f4c3cedae4e9778f11e76e0fa1f1b61b622 DIFF: https://github.com/llvm/llvm-project/commit/eb198f4c3cedae4e9778f11e76e0fa1f1b61b622.diff LOG: [llvm] Use llvm::any_of (NFC) Added: Modified: llvm/include/llvm/CodeGen/LiveInterval.h llvm/lib/CodeGen/MachineSink.cpp llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp llvm/lib/Passes/PassBuilder.cpp llvm/lib/Support/SourceMgr.cpp llvm/lib/Target/AArch64/AArch64InstrInfo.cpp llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/tools/llvm-readobj/ELFDumper.cpp llvm/utils/TableGen/AsmMatcherEmitter.cpp llvm/utils/TableGen/GICombinerEmitter.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h index 6dc1a3074e22..c2b158ac1b7f 100644 --- a/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/llvm/include/llvm/CodeGen/LiveInterval.h @@ -598,10 +598,9 @@ namespace llvm { /// @p End. bool isUndefIn(ArrayRef Undefs, SlotIndex Begin, SlotIndex End) const { - return std::any_of(Undefs.begin(), Undefs.end(), -[Begin,End] (SlotIndex Idx) -> bool { - return Begin <= Idx && Idx < End; -}); + return llvm::any_of(Undefs, [Begin, End](SlotIndex Idx) -> bool { +return Begin <= Idx && Idx < End; + }); } /// Flush segment set into the regular segment vector. diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 48ed8b0c5e73..42ab961b12e8 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -1024,9 +1024,9 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From, return HasStoreCache[BlockPair]; if (StoreInstrCache.find(BlockPair) != StoreInstrCache.end()) -return std::any_of( -StoreInstrCache[BlockPair].begin(), StoreInstrCache[BlockPair].end(), -[&](MachineInstr *I) { return I->mayAlias(AA, MI, false); }); +return llvm::any_of(StoreInstrCache[BlockPair], [&](MachineInstr *I) { + return I->mayAlias(AA, MI, false); +}); bool SawStore = false; bool HasAliasedStore = false; diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp index 78fc5a69d46b..c607ce4d91af 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp @@ -71,10 +71,10 @@ SelfTargetProcessControl::lookupSymbols( for (auto &Elem : Request) { auto *Dylib = jitTargetAddressToPointer(Elem.Handle); -assert(llvm::find_if(DynamicLibraries, - [=](const std::unique_ptr &DL) { - return DL.get() == Dylib; - }) != DynamicLibraries.end() && +assert(llvm::any_of(DynamicLibraries, +[=](const std::unique_ptr &DL) { + return DL.get() == Dylib; +}) && "Invalid handle"); R.push_back(std::vector()); diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 96d96d43b432..7cebb5985614 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -2657,9 +2657,8 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM, return Err; // Add the nested pass manager with the appropriate adaptor. bool UseMemorySSA = (Name == "loop-mssa"); - bool UseBFI = - std::any_of(InnerPipeline.begin(), InnerPipeline.end(), - [](auto Pipeline) { return Pipeline.Name == "licm"; }); + bool UseBFI = llvm::any_of( + InnerPipeline, [](auto Pipeline) { return Pipeline.Name == "licm"; }); FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), UseMemorySSA, UseBFI, DebugLogging)); return Error::success(); diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp index 499d9810677e..89b7dc939dfc 100644 --- a/llvm/lib/Support/SourceMgr.cpp +++ b/llvm/lib/Support/SourceMgr.cpp @@ -522,7 +522,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &OS, bool ShowColors, // map like Clang's TextDiagnostic. For now, we'll just handle tabs by // expanding them later, and bail out rather than show incorrect ranges and // misaligned fixits for any other odd characters. - if (find_if(LineContents, isNonASCII) != LineContents.end()) { + if (any_of(LineContents, isNonASCII)) { printSourceLine(OS, LineContents); return; } diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp ind
[llvm-branch-commits] [llvm] 0edbc90 - [DebugInfo] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-04T11:42:45-08:00 New Revision: 0edbc90ec565758f5243b83b1c0a13beaf21214f URL: https://github.com/llvm/llvm-project/commit/0edbc90ec565758f5243b83b1c0a13beaf21214f DIFF: https://github.com/llvm/llvm-project/commit/0edbc90ec565758f5243b83b1c0a13beaf21214f.diff LOG: [DebugInfo] Use llvm::append_range (NFC) Added: Modified: llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/DebugInfo/MSF/MSFBuilder.cpp llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp Removed: diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h index 59bdd2a7c9f2..3b6d1b0b1a70 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h @@ -697,7 +697,7 @@ class VFTableRecord : public TypeRecord { : TypeRecord(TypeRecordKind::VFTable), CompleteClass(CompleteClass), OverriddenVFTable(OverriddenVFTable), VFPtrOffset(VFPtrOffset) { MethodNames.push_back(Name); -MethodNames.insert(MethodNames.end(), Methods.begin(), Methods.end()); +llvm::append_range(MethodNames, Methods); } TypeIndex getCompleteClass() const { return CompleteClass; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 89b29b428fce..df411bf91041 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -479,8 +479,7 @@ void DWARFDie::collectChildrenAddressRanges( return; if (isSubprogramDIE()) { if (auto DIERangesOrError = getAddressRanges()) - Ranges.insert(Ranges.end(), DIERangesOrError.get().begin(), -DIERangesOrError.get().end()); + llvm::append_range(Ranges, DIERangesOrError.get()); else llvm::consumeError(DIERangesOrError.takeError()); } diff --git a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp index c6fe764ab7e0..f946dd4860ac 100644 --- a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp +++ b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp @@ -204,8 +204,7 @@ Error MSFBuilder::setStreamSize(uint32_t Idx, uint32_t Size) { if (auto EC = allocateBlocks(AddedBlocks, AddedBlockList)) return EC; auto &CurrentBlocks = StreamData[Idx].second; -CurrentBlocks.insert(CurrentBlocks.end(), AddedBlockList.begin(), - AddedBlockList.end()); +llvm::append_range(CurrentBlocks, AddedBlockList); } else if (OldBlocks > NewBlocks) { // For shrinking, free all the Blocks in the Block map, update the stream // data, then shrink the directory. @@ -268,8 +267,7 @@ Expected MSFBuilder::generateLayout() { ExtraBlocks.resize(NumExtraBlocks); if (auto EC = allocateBlocks(NumExtraBlocks, ExtraBlocks)) return std::move(EC); -DirectoryBlocks.insert(DirectoryBlocks.end(), ExtraBlocks.begin(), - ExtraBlocks.end()); +llvm::append_range(DirectoryBlocks, ExtraBlocks); } else if (NumDirectoryBlocks < DirectoryBlocks.size()) { uint32_t NumUnnecessaryBlocks = DirectoryBlocks.size() - NumDirectoryBlocks; for (auto B : diff --git a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp index 4a88391494cd..1d873b87b347 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp @@ -116,7 +116,7 @@ StringMap NamedStreamMap::entries() const { uint32_t NamedStreamMap::appendStringData(StringRef S) { uint32_t Offset = NamesBuffer.size(); - NamesBuffer.insert(NamesBuffer.end(), S.begin(), S.end()); + llvm::append_range(NamesBuffer, S); NamesBuffer.push_back('\0'); return Offset; } diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp index 1296be3c9413..3e734c39e942 100644 --- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp @@ -519,8 +519,7 @@ SymbolCache::findLineTable(uint16_t Modi) const { return LHS[0].Addr < RHS[0].Addr; }); for (size_t I = 0; I < EntryList.size(); ++I) -ModuleLineTable.insert(ModuleLineTable.end(), EntryList[I].begin(), - EntryList[I].end()); +llvm::append_range(ModuleLineTable, EntryList[I]); return ModuleLineTable; } diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp index b5e7b03e6917..5f4f497690b6 100644 --- a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp @@ -91,7 +91,7 @@ void TpiStreamBuilder::addTypeRecords(ArrayRef Types, updat
[llvm-branch-commits] [llvm] 65cd3cb - [Inliner] Compute the full cost for the cost benefit analsysis
Author: Kazu Hirata Date: 2021-01-05T12:48:49-08:00 New Revision: 65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3 URL: https://github.com/llvm/llvm-project/commit/65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3 DIFF: https://github.com/llvm/llvm-project/commit/65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3.diff LOG: [Inliner] Compute the full cost for the cost benefit analsysis This patch teaches the inliner to compute the full cost for a call site where the newly introduced cost benefit analysis is enabled. Note that the cost benefit analysis requires the full cost to be computed. However, without this patch or the -inline-cost-full option, the early termination logic would kick in when the cost exceeds the threshold, so we don't get to perform the cost benefit analysis. For this reason, we would need to specify four clang options: -mllvm -inline-cost-full -mllvm -inline-enable-cost-benefit-analysis This patch eliminates the need to specify -inline-cost-full. Differential Revision: https://reviews.llvm.org/D93658 Added: Modified: llvm/lib/Analysis/InlineCost.cpp Removed: diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index bf8d9c98aa0e..ff589b86bb50 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -901,7 +901,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { bool IgnoreThreshold = false) : CallAnalyzer(Callee, Call, TTI, GetAssumptionCache, GetBFI, PSI, ORE), ComputeFullInlineCost(OptComputeFullInlineCost || - Params.ComputeFullInlineCost || ORE), + Params.ComputeFullInlineCost || ORE || + isCostBenefitAnalysisEnabled()), Params(Params), Threshold(Params.DefaultThreshold), BoostIndirectCalls(BoostIndirect), IgnoreThreshold(IgnoreThreshold), CostBenefitAnalysisEnabled(isCostBenefitAnalysisEnabled()), ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 441650d - [tools] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-05T21:15:56-08:00 New Revision: 441650d5893001f18a0bb9440ea32f6bd2039196 URL: https://github.com/llvm/llvm-project/commit/441650d5893001f18a0bb9440ea32f6bd2039196 DIFF: https://github.com/llvm/llvm-project/commit/441650d5893001f18a0bb9440ea32f6bd2039196.diff LOG: [tools] Use llvm::append_range (NFC) Added: Modified: llvm/tools/bugpoint/ToolRunner.cpp llvm/tools/llvm-cat/llvm-cat.cpp llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp llvm/tools/llvm-stress/llvm-stress.cpp llvm/tools/llvm-xray/xray-graph.cpp Removed: diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp index d880aca044d1..c4ea1dad122b 100644 --- a/llvm/tools/bugpoint/ToolRunner.cpp +++ b/llvm/tools/bugpoint/ToolRunner.cpp @@ -495,7 +495,7 @@ Expected LLC::ExecuteProgram(const std::string &Bitcode, return std::move(E); std::vector CCArgs(ArgsForCC); - CCArgs.insert(CCArgs.end(), SharedLibs.begin(), SharedLibs.end()); + llvm::append_range(CCArgs, SharedLibs); // Assuming LLC worked, compile the result with CC and run it. return cc->ExecuteProgram(OutputAsmFile, Args, *FileKind, InputFile, diff --git a/llvm/tools/llvm-cat/llvm-cat.cpp b/llvm/tools/llvm-cat/llvm-cat.cpp index 85f2b410f870..39848e5d3364 100644 --- a/llvm/tools/llvm-cat/llvm-cat.cpp +++ b/llvm/tools/llvm-cat/llvm-cat.cpp @@ -62,8 +62,7 @@ int main(int argc, char **argv) { errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputFilename))); std::vector Mods = ExitOnErr(getBitcodeModuleList(*MB)); for (auto &BitcodeMod : Mods) { -Buffer.insert(Buffer.end(), BitcodeMod.getBuffer().begin(), - BitcodeMod.getBuffer().end()); +llvm::append_range(Buffer, BitcodeMod.getBuffer()); Writer.copyStrtab(BitcodeMod.getStrtab()); } } diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index abaf3140bcfb..4322f125a84d 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -670,7 +670,7 @@ int main(int argc, char **argv) { std::vector Objects; for (const auto &F : InputFilenames) { auto Objs = expandBundle(F); -Objects.insert(Objects.end(), Objs.begin(), Objs.end()); +llvm::append_range(Objects, Objs); } bool Success = true; diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 2304e91b8b32..f3ce184b4e93 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -182,9 +182,7 @@ Expected BenchmarkRunner::runConfiguration( const ExecutableFunction EF(State.createTargetMachine(), getObjectFromBuffer(OS.str())); const auto FnBytes = EF.getFunctionBytes(); - InstrBenchmark.AssembledSnippet.insert( - InstrBenchmark.AssembledSnippet.end(), FnBytes.begin(), - FnBytes.end()); + llvm::append_range(InstrBenchmark.AssembledSnippet, FnBytes); } // Assemble NumRepetitions instructions repetitions of the snippet for diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp index b1dd5482938b..155eee07e055 100644 --- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp +++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp @@ -416,7 +416,7 @@ static llvm::Error convertFileToGSYM(raw_ostream &OS) { OS << "Input file: " << ConvertFilename << "\n"; auto Objs = expandBundle(ConvertFilename); - Objects.insert(Objects.end(), Objs.begin(), Objs.end()); + llvm::append_range(Objects, Objs); for (auto Object : Objects) { if (auto Err = handleFileConversionToGSYM(Object, OutFile)) diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp index 10ebc1fbf81c..538240d65738 100644 --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -315,8 +315,7 @@ struct Modifier { Type::getFloatTy(Context), Type::getDoubleTy(Context) }); - ScalarTypes.insert(ScalarTypes.end(), -AdditionalScalarTypes.begin(), AdditionalScalarTypes.end()); + llvm::append_range(ScalarTypes, AdditionalScalarTypes); } return ScalarTypes[getRandom() % ScalarTypes.size()]; diff --git a/llvm/tools/llvm-xray/xray-graph.cpp b/llvm/tools/llvm-xray/xray-graph.cpp index 522609b938f2..00a1807c07c9 100644 --- a/llvm/tools/llvm-xray/xray-graph.cpp +++ b/llvm/tools/llvm-xray/xray-graph.cpp @@ -312,8 +312,7 @@ void GraphRenderer::calculateVertexStatistics() { if (V.first != 0) { for (auto &E : G.inEdges(V.first)) { auto &A = E.second; -
[llvm-branch-commits] [llvm] cea1c63 - [MachineSink] Construct SmallVector with iterator ranges (NFC)
Author: Kazu Hirata Date: 2021-01-05T21:15:57-08:00 New Revision: cea1c63756f92f29595251943262b73f7f290f45 URL: https://github.com/llvm/llvm-project/commit/cea1c63756f92f29595251943262b73f7f290f45 DIFF: https://github.com/llvm/llvm-project/commit/cea1c63756f92f29595251943262b73f7f290f45.diff LOG: [MachineSink] Construct SmallVector with iterator ranges (NFC) Added: Modified: llvm/lib/CodeGen/MachineSink.cpp Removed: diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 42ab961b12e8..cede18b658ef 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -1588,7 +1588,6 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB, // recorded which reg units that DBG_VALUEs read, if this instruction // writes any of those units then the corresponding DBG_VALUEs must sink. SetVector DbgValsToSinkSet; -SmallVector DbgValsToSink; for (auto &MO : MI->operands()) { if (!MO.isReg() || !MO.isDef()) continue; @@ -1598,8 +1597,8 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB, for (auto *MI : SeenDbgInstrs.lookup(Reg)) DbgValsToSinkSet.insert(MI); } -DbgValsToSink.insert(DbgValsToSink.begin(), DbgValsToSinkSet.begin(), - DbgValsToSinkSet.end()); +SmallVector DbgValsToSink(DbgValsToSinkSet.begin(), + DbgValsToSinkSet.end()); // Clear the kill flag if SrcReg is killed between MI and the end of the // block. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] cd088ba - [llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)
Author: Kazu Hirata Date: 2021-01-05T21:15:59-08:00 New Revision: cd088ba7e61a6132659d066918a1175861c9afe7 URL: https://github.com/llvm/llvm-project/commit/cd088ba7e61a6132659d066918a1175861c9afe7 DIFF: https://github.com/llvm/llvm-project/commit/cd088ba7e61a6132659d066918a1175861c9afe7.diff LOG: [llvm] Use llvm::lower_bound and llvm::upper_bound (NFC) Added: Modified: llvm/include/llvm/MC/MCSubtargetInfo.h llvm/include/llvm/ProfileData/InstrProf.h llvm/include/llvm/Support/BinaryItemStream.h llvm/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/lib/DWARFLinker/DWARFLinker.cpp llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp llvm/lib/DebugInfo/PDB/UDTLayout.cpp llvm/lib/Object/ELF.cpp llvm/lib/Support/TargetParser.cpp llvm/lib/Target/AArch64/AArch64StackTagging.cpp llvm/tools/llvm-exegesis/lib/Target.cpp llvm/tools/llvm-profgen/ProfiledBinary.h llvm/tools/llvm-xray/xray-stacks.cpp llvm/utils/TableGen/RegisterInfoEmitter.cpp Removed: diff --git a/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h index 901b11e99be7..2c1072d833fb 100644 --- a/llvm/include/llvm/MC/MCSubtargetInfo.h +++ b/llvm/include/llvm/MC/MCSubtargetInfo.h @@ -222,7 +222,7 @@ class MCSubtargetInfo { /// Check whether the CPU string is valid. bool isCPUStringValid(StringRef CPU) const { -auto Found = std::lower_bound(ProcDesc.begin(), ProcDesc.end(), CPU); +auto Found = llvm::lower_bound(ProcDesc, CPU); return Found != ProcDesc.end() && StringRef(Found->Key) == CPU; } diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index 899abf564f3a..9c16c353843d 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -562,10 +562,9 @@ StringRef InstrProfSymtab::getFuncNameOrExternalSymbol(uint64_t FuncMD5Hash) { StringRef InstrProfSymtab::getFuncName(uint64_t FuncMD5Hash) { finalizeSymtab(); - auto Result = - std::lower_bound(MD5NameMap.begin(), MD5NameMap.end(), FuncMD5Hash, - [](const std::pair &LHS, - uint64_t RHS) { return LHS.first < RHS; }); + auto Result = llvm::lower_bound(MD5NameMap, FuncMD5Hash, + [](const std::pair &LHS, + uint64_t RHS) { return LHS.first < RHS; }); if (Result != MD5NameMap.end() && Result->first == FuncMD5Hash) return Result->second; return StringRef(); @@ -573,10 +572,9 @@ StringRef InstrProfSymtab::getFuncName(uint64_t FuncMD5Hash) { Function* InstrProfSymtab::getFunction(uint64_t FuncMD5Hash) { finalizeSymtab(); - auto Result = - std::lower_bound(MD5FuncMap.begin(), MD5FuncMap.end(), FuncMD5Hash, - [](const std::pair &LHS, - uint64_t RHS) { return LHS.first < RHS; }); + auto Result = llvm::lower_bound(MD5FuncMap, FuncMD5Hash, + [](const std::pair &LHS, + uint64_t RHS) { return LHS.first < RHS; }); if (Result != MD5FuncMap.end() && Result->first == FuncMD5Hash) return Result->second; return nullptr; diff --git a/llvm/include/llvm/Support/BinaryItemStream.h b/llvm/include/llvm/Support/BinaryItemStream.h index 4cd66adcc01a..4d27013ce368 100644 --- a/llvm/include/llvm/Support/BinaryItemStream.h +++ b/llvm/include/llvm/Support/BinaryItemStream.h @@ -88,8 +88,7 @@ class BinaryItemStream : public BinaryStream { if (Offset >= getLength()) return make_error(stream_error_code::stream_too_short); ++Offset; -auto Iter = -std::lower_bound(ItemEndOffsets.begin(), ItemEndOffsets.end(), Offset); +auto Iter = llvm::lower_bound(ItemEndOffsets, Offset); size_t Idx = std::distance(ItemEndOffsets.begin(), Iter); assert(Idx < Items.size() && "binary search for offset failed"); return Idx; diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 9f2629c00a7d..57fefc17a97b 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -1016,7 +1016,7 @@ SortNonLocalDepInfoCache(MemoryDependenceResults::NonLocalDepInfo &Cache, NonLocalDepEntry Val = Cache.back(); Cache.pop_back(); MemoryDependenceResults::NonLocalDepInfo::iterator Entry = - std::upper_bound(Cache.begin(), Cache.end(), Val); + llvm::upper_bound(Cache, Val); Cache.insert(Entry, Val); } break; diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp index bcda34066f42..7acf9023c088 100644 --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -52,9 +52,8 @@ static uint64_t getDebugInfoSize(DWARFCon
[llvm-branch-commits] [llvm] 1d0bc05 - [llvm] Use llvm::append_range (NFC)
Author: Kazu Hirata Date: 2021-01-06T18:27:33-08:00 New Revision: 1d0bc05551587046c4a6896215c92f7e1259d10e URL: https://github.com/llvm/llvm-project/commit/1d0bc05551587046c4a6896215c92f7e1259d10e DIFF: https://github.com/llvm/llvm-project/commit/1d0bc05551587046c4a6896215c92f7e1259d10e.diff LOG: [llvm] Use llvm::append_range (NFC) Added: Modified: llvm/include/llvm/ADT/DirectedGraph.h llvm/include/llvm/IR/InstrTypes.h llvm/include/llvm/Support/CFGDiff.h llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/Bitstream/Reader/BitstreamReader.cpp llvm/lib/DWARFLinker/DWARFLinker.cpp llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp llvm/lib/ExecutionEngine/Orc/Core.cpp llvm/lib/IR/Attributes.cpp llvm/lib/IR/IRBuilder.cpp llvm/lib/MC/MCParser/AsmParser.cpp llvm/lib/MC/MCParser/MasmParser.cpp llvm/lib/MC/WasmObjectWriter.cpp llvm/lib/MCA/HardwareUnits/Scheduler.cpp llvm/lib/ProfileData/Coverage/CoverageMapping.cpp llvm/lib/ProfileData/SampleProfReader.cpp llvm/lib/Support/Windows/Program.inc llvm/lib/Support/YAMLParser.cpp llvm/lib/TableGen/Record.cpp Removed: diff --git a/llvm/include/llvm/ADT/DirectedGraph.h b/llvm/include/llvm/ADT/DirectedGraph.h index ec7d754f6e0f..e8bb9e6b2292 100644 --- a/llvm/include/llvm/ADT/DirectedGraph.h +++ b/llvm/include/llvm/ADT/DirectedGraph.h @@ -229,7 +229,7 @@ template class DirectedGraph { if (*Node == N) continue; Node->findEdgesTo(N, TempList); - EL.insert(EL.end(), TempList.begin(), TempList.end()); + llvm::append_range(EL, TempList); TempList.clear(); } return !EL.empty(); diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h index 8a702e3c9c5c..631665e3fc52 100644 --- a/llvm/include/llvm/IR/InstrTypes.h +++ b/llvm/include/llvm/IR/InstrTypes.h @@ -1126,7 +1126,7 @@ template class OperandBundleDefT { explicit OperandBundleDefT(const OperandBundleUse &OBU) { Tag = std::string(OBU.getTagName()); -Inputs.insert(Inputs.end(), OBU.Inputs.begin(), OBU.Inputs.end()); +llvm::append_range(Inputs, OBU.Inputs); } ArrayRef inputs() const { return Inputs; } diff --git a/llvm/include/llvm/Support/CFGDiff.h b/llvm/include/llvm/Support/CFGDiff.h index a4a4b2ca44b1..c90b9aca78b5 100644 --- a/llvm/include/llvm/Support/CFGDiff.h +++ b/llvm/include/llvm/Support/CFGDiff.h @@ -152,7 +152,7 @@ template class GraphDiff { // Add children present in the snapshot for not in the real CFG. auto &AddedChildren = It->second.DI[1]; -Res.insert(Res.end(), AddedChildren.begin(), AddedChildren.end()); +llvm::append_range(Res, AddedChildren); return Res; } diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index b2bb6728c679..28493dd070da 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -6358,8 +6358,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) { } case bitc::FS_TYPE_TESTS: assert(PendingTypeTests.empty()); - PendingTypeTests.insert(PendingTypeTests.end(), Record.begin(), - Record.end()); + llvm::append_range(PendingTypeTests, Record); break; case bitc::FS_TYPE_TEST_ASSUME_VCALLS: diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 4b81ccde4aba..9f62cce028f8 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3629,7 +3629,7 @@ static void writeFunctionTypeMetadataRecords(BitstreamWriter &Stream, Record.clear(); Record.push_back(VC.VFunc.GUID); Record.push_back(VC.VFunc.Offset); - Record.insert(Record.end(), VC.Args.begin(), VC.Args.end()); + llvm::append_range(Record, VC.Args); Stream.EmitRecord(Ty, Record); } }; @@ -3703,7 +3703,7 @@ static void writeWholeProgramDevirtResolutionByArg( SmallVector &NameVals, const std::vector &args, const WholeProgramDevirtResolution::ByArg &ByArg) { NameVals.push_back(args.size()); - NameVals.insert(NameVals.end(), args.begin(), args.end()); + llvm::append_range(NameVals, args); NameVals.push_back(ByArg.TheKind); NameVals.push_back(ByArg.Info); diff --git a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp index 1d4f045efee7..28adfe6268f9 100644 --- a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp +++ b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp @@ -27,8 +27,7 @@ Error BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { if (BlockInfo) { if (const BitstreamBlockInfo::BlockInfo *Info = BlockInfo->getBlockInfo(BlockID)) { - Cu
[llvm-branch-commits] [llvm] 9b228f1 - [llvm] Use BasicBlock::phis() (NFC)
Author: Kazu Hirata Date: 2021-01-06T18:27:35-08:00 New Revision: 9b228f107d43341ef73af92865f73a9a076c5a76 URL: https://github.com/llvm/llvm-project/commit/9b228f107d43341ef73af92865f73a9a076c5a76 DIFF: https://github.com/llvm/llvm-project/commit/9b228f107d43341ef73af92865f73a9a076c5a76.diff LOG: [llvm] Use BasicBlock::phis() (NFC) Added: Modified: llvm/lib/IR/BasicBlock.cpp llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Removed: diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index 7f34565f5cd8..688211877d18 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -440,12 +440,8 @@ BasicBlock *BasicBlock::splitBasicBlockBefore(iterator I, const Twine &BBName) { void BasicBlock::replacePhiUsesWith(BasicBlock *Old, BasicBlock *New) { // N.B. This might not be a complete BasicBlock, so don't assume // that it ends with a non-phi instruction. - for (iterator II = begin(), IE = end(); II != IE; ++II) { -PHINode *PN = dyn_cast(II); -if (!PN) - break; -PN->replaceIncomingBlockWith(Old, New); - } + for (PHINode &PN : phis()) +PN.replaceIncomingBlockWith(Old, New); } void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *Old, diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp index 68c79d2a113f..273d3ab97c7b 100644 --- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp +++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp @@ -2199,13 +2199,10 @@ bool HexagonLoopIdiomRecognize::processCopyingStore(Loop *CurLoop, if (ParentL) ParentL->addBasicBlockToLoop(NewPreheader, *LF); IRBuilder<>(NewPreheader).CreateBr(Header); -for (auto &In : *Header) { - PHINode *PN = dyn_cast(&In); - if (!PN) -break; - int bx = PN->getBasicBlockIndex(Preheader); +for (PHINode &PN : Header->phis()) { + int bx = PN.getBasicBlockIndex(Preheader); if (bx >= 0) -PN->setIncomingBlock(bx, NewPreheader); +PN.setIncomingBlock(bx, NewPreheader); } DT->addNewBlock(NewPreheader, Preheader); DT->changeImmediateDominator(Header, NewPreheader); diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 4cce05d595a8..060ca4bcd8ee 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -483,24 +483,20 @@ static Optional analyzeLoopUnrollCost( // Prepare for the iteration by collecting any simplified entry or backedge // inputs. -for (Instruction &I : *L->getHeader()) { - auto *PHI = dyn_cast(&I); - if (!PHI) -break; - +for (PHINode &PHI : L->getHeader()->phis()) { // The loop header PHI nodes must have exactly two input: one from the // loop preheader and one from the loop latch. assert( - PHI->getNumIncomingValues() == 2 && + PHI.getNumIncomingValues() == 2 && "Must have an incoming value only for the preheader and the latch."); - Value *V = PHI->getIncomingValueForBlock( + Value *V = PHI.getIncomingValueForBlock( Iteration == 0 ? L->getLoopPreheader() : L->getLoopLatch()); Constant *C = dyn_cast(V); if (Iteration != 0 && !C) C = SimplifiedValues.lookup(V); if (C) -SimplifiedInputValues.push_back({PHI, C}); +SimplifiedInputValues.push_back({&PHI, C}); } // Now clear and re-populate the map for the next iteration. @@ -625,12 +621,8 @@ static Optional analyzeLoopUnrollCost( BasicBlock *ExitingBB, *ExitBB; std::tie(ExitingBB, ExitBB) = ExitWorklist.pop_back_val(); -for (Instruction &I : *ExitBB) { - auto *PN = dyn_cast(&I); - if (!PN) -break; - - Value *Op = PN->getIncomingValueForBlock(ExitingBB); +for (PHINode &PN : ExitBB->phis()) { + Value *Op = PN.getIncomingValueForBlock(ExitingBB); if (auto *OpI = dyn_cast(Op)) if (L->contains(OpI)) AddCostRecursively(*OpI, TripCount - 1); diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 68ddebf113d1..ed3f87a7d0e7 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -2843,12 +2843,8 @@ static void computeLiveInValues(BasicBlock::reverse_iterator Begin, static void computeLiveOutSeed(BasicBlock *BB, SetVector &LiveTmp) { for (BasicBlock *Succ : successors(BB)) { -for (auto &I : *Succ) { - PHINode *PN = d
[llvm-branch-commits] [llvm] cfeecdf - [llvm] Use llvm::all_of (NFC)
Author: Kazu Hirata Date: 2021-01-06T18:27:36-08:00 New Revision: cfeecdf7b6df9cd89488948b440f8deeb458104c URL: https://github.com/llvm/llvm-project/commit/cfeecdf7b6df9cd89488948b440f8deeb458104c DIFF: https://github.com/llvm/llvm-project/commit/cfeecdf7b6df9cd89488948b440f8deeb458104c.diff LOG: [llvm] Use llvm::all_of (NFC) Added: Modified: llvm/include/llvm/Analysis/LoopInfoImpl.h llvm/lib/Analysis/CFGPrinter.cpp llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp llvm/lib/CodeGen/MachineOutliner.cpp llvm/lib/IR/Constants.cpp llvm/lib/Target/X86/X86FrameLowering.cpp llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp llvm/utils/TableGen/AsmMatcherEmitter.cpp Removed: diff --git a/llvm/include/llvm/Analysis/LoopInfoImpl.h b/llvm/include/llvm/Analysis/LoopInfoImpl.h index e9d09eeceec0..0730225c342f 100644 --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -675,10 +675,10 @@ static void compareLoops(const LoopT *L, const LoopT *OtherL, const SmallPtrSetImpl &BlocksSet = L->getBlocksSet(); const SmallPtrSetImpl &OtherBlocksSet = L->getBlocksSet(); assert(BlocksSet.size() == OtherBlocksSet.size() && - std::all_of(BlocksSet.begin(), BlocksSet.end(), - [&OtherBlocksSet](const BlockT *BB) { - return OtherBlocksSet.count(BB); - }) && + llvm::all_of(BlocksSet, + [&OtherBlocksSet](const BlockT *BB) { +return OtherBlocksSet.count(BB); + }) && "Mismatched basic blocks in BlocksSets!"); } #endif diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp index d41b0f8d48eb..33b5a4603272 100644 --- a/llvm/lib/Analysis/CFGPrinter.cpp +++ b/llvm/lib/Analysis/CFGPrinter.cpp @@ -279,9 +279,10 @@ void DOTGraphTraits::computeHiddenNodes(const Function *F) { (HideDeoptimizePaths && Node->getTerminatingDeoptimizeCall()); return; } -isHiddenBasicBlock[Node] = std::all_of( -succ_begin(Node), succ_end(Node), -[this](const BasicBlock *BB) { return isHiddenBasicBlock[BB]; }); +isHiddenBasicBlock[Node] = +llvm::all_of(successors(Node), [this](const BasicBlock *BB) { + return isHiddenBasicBlock[BB]; +}); }; /// The post order traversal iteration is done to know the status of /// isHiddenBasicBlock for all the successors on the current BB. diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 71dbe8d44ba7..c621cef8024e 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2230,8 +2230,7 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB, bool &ModifiedDT EVI = dyn_cast(V); if (EVI) { V = EVI->getOperand(0); - if (!std::all_of(EVI->idx_begin(), EVI->idx_end(), - [](unsigned idx) { return idx == 0; })) + if (!llvm::all_of(EVI->indices(), [](unsigned idx) { return idx == 0; })) return false; } diff --git a/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp index 1a3b814075f8..2c86f06a602d 100644 --- a/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp @@ -130,7 +130,7 @@ bool CSEMIRBuilder::checkCopyToDefsPossible(ArrayRef DstOps) { if (DstOps.size() == 1) return true; // always possible to emit copy to just 1 vreg. - return std::all_of(DstOps.begin(), DstOps.end(), [](const DstOp &Op) { + return llvm::all_of(DstOps, [](const DstOp &Op) { DstOp::DstType DT = Op.getDstOpKind(); return DT == DstOp::DstType::Ty_LLT || DT == DstOp::DstType::Ty_RC; }); diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 084ff1c4a9cc..67ef02a4e7b2 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -1089,11 +1089,11 @@ MachineInstrBuilder MachineIRBuilder::buildInstr(unsigned Opc, case TargetOpcode::G_UNMERGE_VALUES: { assert(!DstOps.empty() && "Invalid trivial sequence"); assert(SrcOps.size() == 1 && "Invalid src for Unmerge"); -assert(std::all_of(DstOps.begin(), DstOps.end(), - [&, this](const DstOp &Op) { - return Op.getLLTTy(*getMRI()) == -DstOps[0].getLLTTy(*getMRI()); - }) && +assert(llvm::all_of(DstOps, +[&, this](const DstOp &Op) { + return Op.getLLTTy(*getMRI()) == +
[llvm-branch-commits] [llvm] 8febb2e - [CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC)
Author: Kazu Hirata Date: 2021-01-07T20:29:32-08:00 New Revision: 8febb2e0f56107b3256999c9e1520fdc51fcd1b4 URL: https://github.com/llvm/llvm-project/commit/8febb2e0f56107b3256999c9e1520fdc51fcd1b4 DIFF: https://github.com/llvm/llvm-project/commit/8febb2e0f56107b3256999c9e1520fdc51fcd1b4.diff LOG: [CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC) The last use of the function was removed on Oct 20, 2018 in commit 8d6ff4c0af843e1a61b76d89812aed91e358de34. Added: Modified: llvm/include/llvm/CodeGen/MachineRegisterInfo.h llvm/lib/CodeGen/MachineRegisterInfo.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h index a4da62d0a50f..a1a67058cc55 100644 --- a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h @@ -625,10 +625,6 @@ class MachineRegisterInfo { /// function. Writing to a constant register has no effect. bool isConstantPhysReg(MCRegister PhysReg) const; - /// Returns true if either isConstantPhysReg or TRI->isCallerPreservedPhysReg - /// returns true. This is a utility member function. - bool isCallerPreservedOrConstPhysReg(MCRegister PhysReg) const; - /// Get an iterator over the pressure sets affected by the given physical or /// virtual register. If RegUnit is physical, it must be a register unit (from /// MCRegUnitIterator). diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index f5793c63acbf..9165d6d7bb10 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -532,13 +532,6 @@ bool MachineRegisterInfo::isConstantPhysReg(MCRegister PhysReg) const { return true; } -bool -MachineRegisterInfo::isCallerPreservedOrConstPhysReg(MCRegister PhysReg) const { - const TargetRegisterInfo *TRI = getTargetRegisterInfo(); - return isConstantPhysReg(PhysReg) || - TRI->isCallerPreservedPhysReg(PhysReg, *MF); -} - /// markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the /// specified register as undefined which causes the DBG_VALUE to be /// deleted during LiveDebugVariables analysis. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 33bf1ca - [llvm] Use *Set::contains (NFC)
Author: Kazu Hirata Date: 2021-01-07T20:29:34-08:00 New Revision: 33bf1cad759487f678f2b694866e2608c4b99aea URL: https://github.com/llvm/llvm-project/commit/33bf1cad759487f678f2b694866e2608c4b99aea DIFF: https://github.com/llvm/llvm-project/commit/33bf1cad759487f678f2b694866e2608c4b99aea.diff LOG: [llvm] Use *Set::contains (NFC) Added: Modified: llvm/lib/Transforms/IPO/FunctionAttrs.cpp llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp llvm/lib/Transforms/Scalar/JumpThreading.cpp llvm/lib/Transforms/Scalar/LoopRerollPass.cpp llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Removed: diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 62e3e5ad0a52..5cf5e9463b45 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -1244,7 +1244,7 @@ static bool InstrBreaksNonThrowing(Instruction &I, const SCCNodeSet &SCCNodes) { // I is a may-throw call to a function inside our SCC. This doesn't // invalidate our current working assumption that the SCC is no-throw; we // just have to scan that other function. - if (SCCNodes.count(Callee) > 0) + if (SCCNodes.contains(Callee)) return false; } } @@ -1264,7 +1264,7 @@ static bool InstrBreaksNoFree(Instruction &I, const SCCNodeSet &SCCNodes) { if (Callee->doesNotFreeMemory()) return false; - if (SCCNodes.count(Callee) > 0) + if (SCCNodes.contains(Callee)) return false; return true; diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 8750e83623e6..a3d86e26fe23 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -2523,7 +2523,7 @@ Instruction *InstCombinerImpl::optimizeBitCastFromPhi(CastInst &CI, if (BCI == &CI) RetVal = I; } else if (auto *PHI = dyn_cast(V)) { -assert(OldPhiNodes.count(PHI) > 0); +assert(OldPhiNodes.contains(PHI)); (void) PHI; } else { llvm_unreachable("all uses should be handled"); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 08877797c53a..888166f1f53d 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -502,7 +502,7 @@ static bool canRewriteGEPAsOffset(Value *Start, Value *Base, Value *V = WorkList.back(); - if (Explored.count(V) != 0) { + if (Explored.contains(V)) { WorkList.pop_back(); continue; } diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp index d9416072793a..927c34180db9 100644 --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -731,7 +731,7 @@ static Instruction* getBranchInsertPoint(RegInfo &RI) { } } for (Instruction &I : *EntryBB) { -if (EntryBlockSelectSet.count(&I) > 0) { +if (EntryBlockSelectSet.contains(&I)) { assert(&I == HoistPoint && "HoistPoint must be the first one in Selects"); break; @@ -1304,17 +1304,17 @@ void CHR::classifyBiasedScopes(CHRScope *Scope, CHRScope *OutermostScope) { for (RegInfo &RI : Scope->RegInfos) { if (RI.HasBranch) { Region *R = RI.R; - if (TrueBiasedRegionsGlobal.count(R) > 0) + if (TrueBiasedRegionsGlobal.contains(R)) OutermostScope->TrueBiasedRegions.insert(R); - else if (FalseBiasedRegionsGlobal.count(R) > 0) + else if (FalseBiasedRegionsGlobal.contains(R)) OutermostScope->FalseBiasedRegions.insert(R); else llvm_unreachable("Must be biased"); } for (SelectInst *SI : RI.Selects) { - if (TrueBiasedSelectsGlobal.count(SI) > 0) + if (TrueBiasedSelectsGlobal.contains(SI)) OutermostScope->TrueBiasedSelects.insert(SI); - else if (FalseBiasedSelectsGlobal.count(SI) > 0) + else if (FalseBiasedSelectsGlobal.contains(SI)) OutermostScope->FalseBiasedSelects.insert(SI); else llvm_unreachable("Must be biased"); @@ -1397,8 +1397,8 @@ void CHR::setCHRRegions(CHRScope *Scope, CHRScope *OutermostScope) { DenseSet HoistStops; bool IsHoisted = false; if (RI.HasBranch) { - assert((OutermostScope->TrueBiasedRegions.count(R) > 0 || - OutermostScope->FalseBiasedRegions.count(R) > 0) && + assert((OutermostScope->TrueBiasedRegions.cont
[llvm-branch-commits] [llvm] b934160 - [Target] Use llvm::find_if (NFC)
Author: Kazu Hirata Date: 2021-01-07T20:29:36-08:00 New Revision: b934160aaa36be42d5b868704157f30339e7d855 URL: https://github.com/llvm/llvm-project/commit/b934160aaa36be42d5b868704157f30339e7d855 DIFF: https://github.com/llvm/llvm-project/commit/b934160aaa36be42d5b868704157f30339e7d855.diff LOG: [Target] Use llvm::find_if (NFC) Added: Modified: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp llvm/lib/Target/AMDGPU/GCNRegPressure.cpp llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/X86/X86InstructionSelector.cpp Removed: diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 40435c12ca3b..fdf3acfe68c5 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -5425,10 +5425,10 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, // take care of putting the two halves in the right place but we have to // combine them. SDValue &Bits = -std::find_if(RegsToPass.begin(), RegsToPass.end(), - [=](const std::pair &Elt) { - return Elt.first == VA.getLocReg(); - }) +llvm::find_if(RegsToPass, + [=](const std::pair &Elt) { +return Elt.first == VA.getLocReg(); + }) ->second; Bits = DAG.getNode(ISD::OR, DL, Bits.getValueType(), Bits, Arg); // Call site info is used for function's parameter entry value @@ -5709,11 +5709,9 @@ AArch64TargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv, if (RegsUsed.count(VA.getLocReg())) { SDValue &Bits = - std::find_if(RetVals.begin(), RetVals.end(), - [=](const std::pair &Elt) { - return Elt.first == VA.getLocReg(); - }) - ->second; + llvm::find_if(RetVals, [=](const std::pair &Elt) { +return Elt.first == VA.getLocReg(); + })->second; Bits = DAG.getNode(ISD::OR, DL, Bits.getValueType(), Bits, Arg); } else { RetVals.emplace_back(VA.getLocReg(), Arg); diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index 4a60fc7dd8e5..7f68174e506d 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -1578,11 +1578,10 @@ bool AMDGPUSymbolizer::tryAddingSymbolicOperand(MCInst &Inst, if (!Symbols) return false; - auto Result = std::find_if(Symbols->begin(), Symbols->end(), - [Value](const SymbolInfoTy& Val) { -return Val.Addr == static_cast(Value) -&& Val.Type == ELF::STT_NOTYPE; - }); + auto Result = llvm::find_if(*Symbols, [Value](const SymbolInfoTy &Val) { +return Val.Addr == static_cast(Value) && + Val.Type == ELF::STT_NOTYPE; + }); if (Result != Symbols->end()) { auto *Sym = Ctx.getOrCreateSymbol(Result->Name); const auto *Add = MCSymbolRefExpr::create(Sym, Ctx); diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp index 7f66b4136e6a..7bac44476f05 100644 --- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp +++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp @@ -224,9 +224,8 @@ collectVirtualRegUses(const MachineInstr &MI, const LiveIntervals &LIS, auto const UsedMask = getUsedRegMask(MO, MRI, LIS); auto Reg = MO.getReg(); -auto I = std::find_if(Res.begin(), Res.end(), [Reg](const RegisterMaskPair &RM) { - return RM.RegUnit == Reg; -}); +auto I = llvm::find_if( +Res, [Reg](const RegisterMaskPair &RM) { return RM.RegUnit == Reg; }); if (I != Res.end()) I->LaneMask |= UsedMask; else diff --git a/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp b/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp index de8ec4f1a6b0..80fcb099ffaa 100644 --- a/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp @@ -264,11 +264,10 @@ static bool lowerShiftReservedVGPR(MachineFunction &MF, // Find saved info about the pre-reserved register. const auto *ReservedVGPRInfoItr = - std::find_if(FuncInfo->getSGPRSpillVGPRs().begin(), - FuncInfo->getSGPRSpillVGPRs().end(), - [PreReservedVGPR](const auto &SpillRegInfo) { - retur
[llvm-branch-commits] [llvm] b7c5e0b - [Target, Transforms] Use *Set::contains (NFC)
Author: Kazu Hirata Date: 2021-01-08T18:39:54-08:00 New Revision: b7c5e0b02ccfd12b26432b2408a71d4c05902339 URL: https://github.com/llvm/llvm-project/commit/b7c5e0b02ccfd12b26432b2408a71d4c05902339 DIFF: https://github.com/llvm/llvm-project/commit/b7c5e0b02ccfd12b26432b2408a71d4c05902339.diff LOG: [Target, Transforms] Use *Set::contains (NFC) Added: Modified: llvm/lib/Analysis/DomTreeUpdater.cpp llvm/lib/CodeGen/LexicalScopes.cpp llvm/lib/CodeGen/LiveVariables.cpp llvm/lib/CodeGen/MachinePipeliner.cpp llvm/lib/CodeGen/MachineSink.cpp llvm/lib/CodeGen/RegAllocPBQP.cpp llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp llvm/lib/Target/PowerPC/PPCMacroFusion.cpp llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp Removed: diff --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp index e690d6491356..8ac7d9d4efd0 100644 --- a/llvm/lib/Analysis/DomTreeUpdater.cpp +++ b/llvm/lib/Analysis/DomTreeUpdater.cpp @@ -166,7 +166,7 @@ bool DomTreeUpdater::hasPendingPostDomTreeUpdates() const { bool DomTreeUpdater::isBBPendingDeletion(llvm::BasicBlock *DelBB) const { if (Strategy == UpdateStrategy::Eager || DeletedBBs.empty()) return false; - return DeletedBBs.count(DelBB) != 0; + return DeletedBBs.contains(DelBB); } // The DT and PDT require the nodes related to updates diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp index 690b429832a5..8139c2cbb6cd 100644 --- a/llvm/lib/CodeGen/LexicalScopes.cpp +++ b/llvm/lib/CodeGen/LexicalScopes.cpp @@ -324,7 +324,7 @@ bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) { Set = std::make_unique(); getMachineBasicBlocks(DL, *Set); } - return Set->count(MBB) != 0; + return Set->contains(MBB); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index 6490a797fd60..49b880c30936 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -666,7 +666,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) { // other part of the code generator if this happens. #ifndef NDEBUG for(MachineFunction::iterator i = MF->begin(), e = MF->end(); i != e; ++i) -assert(Visited.count(&*i) != 0 && "unreachable basic block found"); +assert(Visited.contains(&*i) && "unreachable basic block found"); #endif PhysRegDef.clear(); diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index db4d78af5fa6..9564192761d2 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1595,12 +1595,12 @@ static bool computePath(SUnit *Cur, SetVector &Path, SmallPtrSet &Visited) { if (Cur->isBoundaryNode()) return false; - if (Exclude.count(Cur) != 0) + if (Exclude.contains(Cur)) return false; - if (DestNodes.count(Cur) != 0) + if (DestNodes.contains(Cur)) return true; if (!Visited.insert(Cur).second) -return Path.count(Cur) != 0; +return Path.contains(Cur); bool FoundPath = false; for (auto &SI : Cur->Succs) FoundPath |= computePath(SI.getSUnit(), Path, DestNodes, Exclude, Visited); @@ -1956,7 +1956,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) { for (const auto &I : maxHeight->Succs) { if (Nodes.count(I.getSUnit()) == 0) continue; -if (NodeOrder.count(I.getSUnit()) != 0) +if (NodeOrder.contains(I.getSUnit())) continue; if (ignoreDependence(I, false)) continue; @@ -1968,7 +1968,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) { continue; if (Nodes.count(I.getSUnit()) == 0) continue; -if (NodeOrder.count(I.getSUnit()) != 0) +if (NodeOrder.contains(I.getSUnit())) continue; R.insert(I.getSUnit()); } @@ -2007,7 +2007,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) { for (const auto &I : maxDepth->Preds) { if (Nodes.count(I.getSUnit()) == 0) continue; -if (NodeOrder.count(I.getSUnit()) != 0) +if (NodeOrder.contains(I.getSUnit())) continue; R.insert(I.getSUnit()); } @@ -2017,7 +2017,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) { continue; if (Nodes.count(I.getSUnit()) == 0) continue; -if (NodeOrder.count(I.getSUnit()) != 0) +if (NodeOrder.contains(I.getSUnit())) continue; R.insert(I.getSUnit()); } diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/Code
[llvm-branch-commits] [llvm] 1c5b848 - [Tablegen] Use llvm::find_if (NFC)
Author: Kazu Hirata Date: 2021-01-08T18:39:55-08:00 New Revision: 1c5b8482b7a212f2225bbfe122d39fb970bd176e URL: https://github.com/llvm/llvm-project/commit/1c5b8482b7a212f2225bbfe122d39fb970bd176e DIFF: https://github.com/llvm/llvm-project/commit/1c5b8482b7a212f2225bbfe122d39fb970bd176e.diff LOG: [Tablegen] Use llvm::find_if (NFC) Added: Modified: llvm/utils/TableGen/CodeGenDAGPatterns.cpp llvm/utils/TableGen/DirectiveEmitter.cpp llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp llvm/utils/TableGen/GlobalISelEmitter.cpp Removed: diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 2f8abe6dffed..857d7f56ad77 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -3701,10 +3701,11 @@ void CodeGenDAGPatterns::parseInstructionPattern( for (unsigned i = 0; i != NumResults; ++i) { if (i == CGI.Operands.size()) { const std::string &OpName = - std::find_if(InstResults.begin(), InstResults.end(), - [](const std::pair &P) { - return P.second; - }) + llvm::find_if( + InstResults, + [](const std::pair &P) { +return P.second; + }) ->first; I.error("'" + OpName + "' set but does not appear in operand list!"); diff --git a/llvm/utils/TableGen/DirectiveEmitter.cpp b/llvm/utils/TableGen/DirectiveEmitter.cpp index 9e8aa4d9f74f..590fedbb02c5 100644 --- a/llvm/utils/TableGen/DirectiveEmitter.cpp +++ b/llvm/utils/TableGen/DirectiveEmitter.cpp @@ -273,9 +273,8 @@ void GenerateGetKind(const std::vector &Records, raw_ostream &OS, StringRef Enum, const DirectiveLanguage &DirLang, StringRef Prefix, bool ImplicitAsUnknown) { - auto DefaultIt = std::find_if(Records.begin(), Records.end(), [](Record *R) { -return R->getValueAsBit("isDefault") == true; - }); + auto DefaultIt = llvm::find_if( + Records, [](Record *R) { return R->getValueAsBit("isDefault") == true; }); if (DefaultIt == Records.end()) { PrintError("At least one " + Enum + " must be defined as default."); @@ -312,10 +311,9 @@ void GenerateGetKindClauseVal(const DirectiveLanguage &DirLang, if (ClauseVals.size() <= 0) continue; -auto DefaultIt = -std::find_if(ClauseVals.begin(), ClauseVals.end(), [](Record *CV) { - return CV->getValueAsBit("isDefault") == true; -}); +auto DefaultIt = llvm::find_if(ClauseVals, [](Record *CV) { + return CV->getValueAsBit("isDefault") == true; +}); if (DefaultIt == ClauseVals.end()) { PrintError("At least one val in Clause " + C.getFormattedName() + diff --git a/llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp b/llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp index 96dc4fc94893..b7155398bd30 100644 --- a/llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp +++ b/llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp @@ -266,11 +266,10 @@ void GIMatchTreeBuilder::runStep() { LLVM_DEBUG(dbgs() << "Leaf contains multiple rules, drop after the first " "fully tested rule\n"); auto FirstFullyTested = - std::find_if(Leaves.begin(), Leaves.end(), - [](const GIMatchTreeBuilderLeafInfo &X) { - return X.isFullyTraversed() && X.isFullyTested() && -!X.getMatchDag().hasPostMatchPredicate(); - }); + llvm::find_if(Leaves, [](const GIMatchTreeBuilderLeafInfo &X) { +return X.isFullyTraversed() && X.isFullyTested() && + !X.getMatchDag().hasPostMatchPredicate(); + }); if (FirstFullyTested != Leaves.end()) FirstFullyTested++; diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 29ca558580fe..28c7d8b9634a 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -2249,10 +2249,10 @@ class InstructionMatcher final : public PredicateListMatcher { } OperandMatcher &getOperand(unsigned OpIdx) { -auto I = std::find_if(Operands.begin(), Operands.end(), - [&OpIdx](const std::unique_ptr &X) { -return X->getOpIdx() == OpIdx; - }); +auto I = llvm::find_if(Operands, + [&OpIdx](const std::unique_ptr &X) { + return X->getOpIdx() == OpIdx; + }); if (I != Operands.end()) return **I; llvm_unreachable("Failed to lookup operand"); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.or
[llvm-branch-commits] [llvm] f62b93b - [SCEV] Remove unused getExactExistingExpansion (NFC)
Author: Kazu Hirata Date: 2021-01-08T18:39:57-08:00 New Revision: f62b93b9a250cf5449c05b8ca7da4c112ddc0458 URL: https://github.com/llvm/llvm-project/commit/f62b93b9a250cf5449c05b8ca7da4c112ddc0458 DIFF: https://github.com/llvm/llvm-project/commit/f62b93b9a250cf5449c05b8ca7da4c112ddc0458.diff LOG: [SCEV] Remove unused getExactExistingExpansion (NFC) The last use was removed on Sep 4, 2018 in commit 2cbba5633753552a984572c8b9a5997e5c96496d. Added: Modified: llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp Removed: diff --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h index 67a406d2492b..68eccdfd011d 100644 --- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h +++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h @@ -365,10 +365,6 @@ class SCEVExpander : public SCEVVisitor { void setChainedPhi(PHINode *PN) { ChainedPhis.insert(PN); } - /// Try to find existing LLVM IR value for S available at the point At. - Value *getExactExistingExpansion(const SCEV *S, const Instruction *At, - Loop *L); - /// Try to find the ValueOffsetPair for S. The function is mainly used to /// check whether S can be expanded cheaply. If this returns a non-None /// value, we know we can codegen the `ValueOffsetPair` into a suitable diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 6c112b586f1a..f58e2d927840 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -2152,15 +2152,6 @@ SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT, return NumElim; } -Value *SCEVExpander::getExactExistingExpansion(const SCEV *S, - const Instruction *At, Loop *L) { - Optional VO = - getRelatedExistingExpansion(S, At, L); - if (VO && VO.getValue().second == nullptr) -return VO.getValue().first; - return nullptr; -} - Optional SCEVExpander::getRelatedExistingExpansion(const SCEV *S, const Instruction *At, Loop *L) { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 9a7c03b - [SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC)
Author: Kazu Hirata Date: 2021-01-09T09:24:56-08:00 New Revision: 9a7c03b80092d8efb57f7176d14b2bfa7743f245 URL: https://github.com/llvm/llvm-project/commit/9a7c03b80092d8efb57f7176d14b2bfa7743f245 DIFF: https://github.com/llvm/llvm-project/commit/9a7c03b80092d8efb57f7176d14b2bfa7743f245.diff LOG: [SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC) The last use was removed on Mar 22, 2012 in commit f47d0af5515bee47dfd000363740fe347bb6cd18. Added: Modified: llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp Removed: diff --git a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h index 68eccdfd011d..547245cfb963 100644 --- a/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h +++ b/llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h @@ -247,12 +247,6 @@ class SCEVExpander : public SCEVVisitor { return false; } - /// This method returns the canonical induction variable of the specified - /// type for the specified loop (inserting one if there is none). A - /// canonical induction variable starts at zero and steps by one on each - /// iteration. - PHINode *getOrInsertCanonicalInductionVariable(const Loop *L, Type *Ty); - /// Return the induction variable increment's IV operand. Instruction *getIVIncOperand(Instruction *IncV, Instruction *InsertPos, bool allowScale); diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index f58e2d927840..f3a8d75dc853 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -1986,28 +1986,6 @@ void SCEVExpander::rememberInstruction(Value *I) { } } -/// getOrInsertCanonicalInductionVariable - This method returns the -/// canonical induction variable of the specified type for the specified -/// loop (inserting one if there is none). A canonical induction variable -/// starts at zero and steps by one on each iteration. -PHINode * -SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L, -Type *Ty) { - assert(Ty->isIntegerTy() && "Can only insert integer induction variables!"); - - // Build a SCEV for {0,+,1}. - // Conservatively use FlagAnyWrap for now. - const SCEV *H = SE.getAddRecExpr(SE.getConstant(Ty, 0), - SE.getConstant(Ty, 1), L, SCEV::FlagAnyWrap); - - // Emit code for it. - SCEVInsertPointGuard Guard(Builder, this); - PHINode *V = cast(expandCodeForImpl( - H, nullptr, &*L->getHeader()->getFirstInsertionPt(), false)); - - return V; -} - /// replaceCongruentIVs - Check for congruent phis in this loop header and /// replace them with their most canonical representative. Return the number of /// phis eliminated. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 4d92ab1 - [Transforms] Use llvm::find_if (NFC)
Author: Kazu Hirata Date: 2021-01-09T09:24:58-08:00 New Revision: 4d92ab1669a4a74219c655e00c6de6ea03b16fe8 URL: https://github.com/llvm/llvm-project/commit/4d92ab1669a4a74219c655e00c6de6ea03b16fe8 DIFF: https://github.com/llvm/llvm-project/commit/4d92ab1669a4a74219c655e00c6de6ea03b16fe8.diff LOG: [Transforms] Use llvm::find_if (NFC) Added: Modified: llvm/lib/Transforms/Scalar/GVNHoist.cpp llvm/lib/Transforms/Scalar/LICM.cpp llvm/lib/Transforms/Scalar/MergeICmps.cpp Removed: diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 8478521952b15..e2b40942f300f 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -888,8 +888,7 @@ void GVNHoist::findHoistableCandidates(OutValuesType &CHIBBs, auto TI = BB->getTerminator(); auto B = CHIs.begin(); // [PreIt, PHIIt) form a range of CHIs which have identical VNs. -auto PHIIt = std::find_if(CHIs.begin(), CHIs.end(), - [B](CHIArg &A) { return A != *B; }); +auto PHIIt = llvm::find_if(CHIs, [B](CHIArg &A) { return A != *B; }); auto PrevIt = CHIs.begin(); while (PrevIt != PHIIt) { // Collect values which satisfy safety checks. diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 1b14bc972a9ea..c26d588d9d458 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -624,7 +624,7 @@ class ControlFlowHoister { else if (!TrueDestSucc.empty()) { Function *F = TrueDest->getParent(); auto IsSucc = [&](BasicBlock &BB) { return TrueDestSucc.count(&BB); }; -auto It = std::find_if(F->begin(), F->end(), IsSucc); +auto It = llvm::find_if(*F, IsSucc); assert(It != F->end() && "Could not find successor in function"); CommonSucc = &*It; } @@ -692,8 +692,7 @@ class ControlFlowHoister { return BB != Pair.second && (Pair.first->getSuccessor(0) == BB || Pair.first->getSuccessor(1) == BB); }; -auto It = std::find_if(HoistableBranches.begin(), HoistableBranches.end(), - HasBBAsSuccessor); +auto It = llvm::find_if(HoistableBranches, HasBBAsSuccessor); // If not involved in a pending branch, hoist to preheader BasicBlock *InitialPreheader = CurLoop->getLoopPreheader(); diff --git a/llvm/lib/Transforms/Scalar/MergeICmps.cpp b/llvm/lib/Transforms/Scalar/MergeICmps.cpp index 1559e7a41a7cb..7f8b75ac88067 100644 --- a/llvm/lib/Transforms/Scalar/MergeICmps.cpp +++ b/llvm/lib/Transforms/Scalar/MergeICmps.cpp @@ -628,9 +628,8 @@ static BasicBlock *mergeComparisons(ArrayRef Comparisons, // If there is one block that requires splitting, we do it now, i.e. // just before we know we will collapse the chain. The instructions // can be executed before any of the instructions in the chain. - const auto ToSplit = - std::find_if(Comparisons.begin(), Comparisons.end(), - [](const BCECmpBlock &B) { return B.RequireSplit; }); + const auto ToSplit = llvm::find_if( + Comparisons, [](const BCECmpBlock &B) { return B.RequireSplit; }); if (ToSplit != Comparisons.end()) { LLVM_DEBUG(dbgs() << "Splitting non_BCE work to header\n"); ToSplit->split(BB, AA); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6a6e382 - [llvm] Drop unnecessary make_range (NFC)
Author: Kazu Hirata Date: 2021-01-09T09:25:00-08:00 New Revision: 6a6e382161a9e37d8022de205bd1e1ac5762befd URL: https://github.com/llvm/llvm-project/commit/6a6e382161a9e37d8022de205bd1e1ac5762befd DIFF: https://github.com/llvm/llvm-project/commit/6a6e382161a9e37d8022de205bd1e1ac5762befd.diff LOG: [llvm] Drop unnecessary make_range (NFC) Added: Modified: llvm/lib/Analysis/LoopAccessAnalysis.cpp llvm/lib/Analysis/StackSafetyAnalysis.cpp llvm/lib/CodeGen/MachineOutliner.cpp llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp llvm/tools/dsymutil/DebugMap.cpp llvm/utils/TableGen/CodeGenSchedule.cpp llvm/utils/TableGen/InstrInfoEmitter.cpp Removed: diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 76e172534176..e632fe25c24c 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -987,7 +987,7 @@ static bool isNoWrapAddRec(Value *Ptr, const SCEVAddRecExpr *AR, // Make sure there is only one non-const index and analyze that. Value *NonConstIndex = nullptr; - for (Value *Index : make_range(GEP->idx_begin(), GEP->idx_end())) + for (Value *Index : GEP->indices()) if (!isa(Index)) { if (NonConstIndex) return false; diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp index 8c9bce4ba67c..73096eb4baef 100644 --- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -456,7 +456,7 @@ FunctionInfo StackSafetyLocalAnalysis::run() { analyzeAllUses(AI, UI, SL); } - for (Argument &A : make_range(F.arg_begin(), F.arg_end())) { + for (Argument &A : F.args()) { // Non pointers and bypass arguments are not going to be used in any global // processing. if (A.getType()->isPointerTy() && !A.hasByValAttr()) { diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index e2c15c64dc6d..02998d41d831 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -688,7 +688,7 @@ MachineFunction *MachineOutliner::createOutlinedFunction( // The live-in set for the outlined function is the union of the live-ins // from all the outlining points. -for (MCPhysReg Reg : make_range(CandLiveIns.begin(), CandLiveIns.end())) +for (MCPhysReg Reg : CandLiveIns) LiveIns.addReg(Reg); } addLiveIns(MBB, LiveIns); diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 6e64a1ddf787..d189d946ab42 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -485,11 +485,10 @@ bool Formula::isCanonical(const Loop &L) const { // If ScaledReg is not a recurrent expr, or it is but its loop is not current // loop, meanwhile BaseRegs contains a recurrent expr reg related with current // loop, we want to swap the reg in BaseRegs with ScaledReg. - auto I = - find_if(make_range(BaseRegs.begin(), BaseRegs.end()), [&](const SCEV *S) { -return isa(S) && - (cast(S)->getLoop() == &L); - }); + auto I = find_if(BaseRegs, [&](const SCEV *S) { +return isa(S) && + (cast(S)->getLoop() == &L); + }); return I == BaseRegs.end(); } @@ -518,11 +517,10 @@ void Formula::canonicalize(const Loop &L) { // reg with ScaledReg. const SCEVAddRecExpr *SAR = dyn_cast(ScaledReg); if (!SAR || SAR->getLoop() != &L) { -auto I = find_if(make_range(BaseRegs.begin(), BaseRegs.end()), - [&](const SCEV *S) { - return isa(S) && - (cast(S)->getLoop() == &L); - }); +auto I = find_if(BaseRegs, [&](const SCEV *S) { + return isa(S) && + (cast(S)->getLoop() == &L); +}); if (I != BaseRegs.end()) std::swap(ScaledReg, *I); } diff --git a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp index 7a80f3ff80a5..ac3b3505dc34 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp @@ -191,7 +191,7 @@ void VPlanPredicator::predicateRegionRec(VPRegionBlock *Region) { // Generate edge predicates and append them to the block predicate. RPO is // necessary since the predecessor blocks' block predicate needs to be set // before the current block's block predicate can be computed. - for (VPBlockBase *Block : make_range(RPOT.begin(), RPOT.end())) { + for (VPBlockBase *Block : RPOT) { // TODO: Handle nested regions once we start generating the same. assert(!isa(Block) && "Nested region not expected"); createOrPropagatePredica
[llvm-branch-commits] [llvm] 9850d3b - [CodeGen, DebugInfo] Use llvm::find_if (NFC)
Author: Kazu Hirata Date: 2021-01-10T09:24:53-08:00 New Revision: 9850d3b10a10aff00d31adf0633a4ba2b840f824 URL: https://github.com/llvm/llvm-project/commit/9850d3b10a10aff00d31adf0633a4ba2b840f824 DIFF: https://github.com/llvm/llvm-project/commit/9850d3b10a10aff00d31adf0633a4ba2b840f824.diff LOG: [CodeGen, DebugInfo] Use llvm::find_if (NFC) Added: Modified: llvm/lib/CodeGen/CodeGenPrepare.cpp llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp llvm/lib/CodeGen/MIRCanonicalizerPass.cpp llvm/lib/CodeGen/RegisterScavenging.cpp llvm/lib/CodeGen/SwiftErrorValueTracking.cpp llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp Removed: diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 85371d0d5d31..564a3d7d9bc8 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -633,8 +633,8 @@ void CodeGenPrepare::removeAllAssertingVHReferences(Value *V) { return; auto &GEPVector = VecI->second; - const auto &I = std::find_if(GEPVector.begin(), GEPVector.end(), - [=](auto &Elt) { return Elt.first == GEP; }); + const auto &I = + llvm::find_if(GEPVector, [=](auto &Elt) { return Elt.first == GEP; }); if (I == GEPVector.end()) return; diff --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp index a068e6669957..ff3f93d51ea8 100644 --- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp +++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp @@ -1104,10 +1104,8 @@ InterleavedLoadCombineImpl::findFirstLoad(const std::set &LIs) { // All LIs are within the same BB. Select the first for a reference. BasicBlock *BB = (*LIs.begin())->getParent(); - BasicBlock::iterator FLI = - std::find_if(BB->begin(), BB->end(), [&LIs](Instruction &I) -> bool { -return is_contained(LIs, &I); - }); + BasicBlock::iterator FLI = llvm::find_if( + *BB, [&LIs](Instruction &I) -> bool { return is_contained(LIs, &I); }); assert(FLI != BB->end()); return cast(FLI); diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp index f820b6cc3fc4..b6fb6731d65c 100644 --- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp +++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp @@ -275,9 +275,9 @@ static bool rescheduleCanonically(unsigned &PseudoIdempotentInstCount, // Sort the defs for users of multiple defs lexographically. for (const auto &E : MultiUserLookup) { -auto UseI = -std::find_if(MBB->instr_begin(), MBB->instr_end(), - [&](MachineInstr &MI) -> bool { return &MI == E.second; }); +auto UseI = llvm::find_if(MBB->instrs(), [&](MachineInstr &MI) -> bool { + return &MI == E.second; +}); if (UseI == MBB->instr_end()) continue; diff --git a/llvm/lib/CodeGen/RegisterScavenging.cpp b/llvm/lib/CodeGen/RegisterScavenging.cpp index ab8f4fd9778b..93e8e27d12aa 100644 --- a/llvm/lib/CodeGen/RegisterScavenging.cpp +++ b/llvm/lib/CodeGen/RegisterScavenging.cpp @@ -634,11 +634,10 @@ static Register scavengeVReg(MachineRegisterInfo &MRI, RegScavenger &RS, // we get a single contiguous lifetime. // // Definitions in MRI.def_begin() are unordered, search for the first. - MachineRegisterInfo::def_iterator FirstDef = -std::find_if(MRI.def_begin(VReg), MRI.def_end(), - [VReg, &TRI](const MachineOperand &MO) { - return !MO.getParent()->readsRegister(VReg, &TRI); -}); + MachineRegisterInfo::def_iterator FirstDef = llvm::find_if( + MRI.def_operands(VReg), [VReg, &TRI](const MachineOperand &MO) { +return !MO.getParent()->readsRegister(VReg, &TRI); + }); assert(FirstDef != MRI.def_end() && "Must have one definition that does not redefine vreg"); MachineInstr &DefMI = *FirstDef->getParent(); diff --git a/llvm/lib/CodeGen/SwiftErrorValueTracking.cpp b/llvm/lib/CodeGen/SwiftErrorValueTracking.cpp index dd0b9d4c2e48..4408011c95c0 100644 --- a/llvm/lib/CodeGen/SwiftErrorValueTracking.cpp +++ b/llvm/lib/CodeGen/SwiftErrorValueTracking.cpp @@ -202,8 +202,8 @@ void SwiftErrorValueTracking::propagateVRegs() { // downward defs. bool needPHI = VRegs.size() >= 1 && - std::find_if( - VRegs.begin(), VRegs.end(), + llvm::find_if( + VRegs, [&](const std::pair &V) -> bool { return V.second != VRegs[0].second; }) != VRegs.end(); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp index 252b58e5a591..ace7000f07b2 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp @@ -71,8 +71,8 @@ void DWARFGdbIndex::dumpSymbolTable
[llvm-branch-commits] [llvm] 1d10a1d - [MemorySSA] Remove unused dominatesUse (NFC)
Author: Kazu Hirata Date: 2021-01-10T09:24:55-08:00 New Revision: 1d10a1d5b1ff8fc9ce923b6ea92f049c73a669ab URL: https://github.com/llvm/llvm-project/commit/1d10a1d5b1ff8fc9ce923b6ea92f049c73a669ab DIFF: https://github.com/llvm/llvm-project/commit/1d10a1d5b1ff8fc9ce923b6ea92f049c73a669ab.diff LOG: [MemorySSA] Remove unused dominatesUse (NFC) The function was introduced without a use on Feb 2, 2016 in commit e1100f533f0a48f55e80e1152b06f5deab5f9b30. Added: Modified: llvm/include/llvm/Analysis/MemorySSA.h llvm/lib/Analysis/MemorySSA.cpp Removed: diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h index 5dfae50ad3ae..63c031b1921f 100644 --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -850,7 +850,6 @@ class MemorySSA { using DefsMap = DenseMap>; void markUnreachableAsLiveOnEntry(BasicBlock *BB); - bool dominatesUse(const MemoryAccess *, const MemoryAccess *) const; MemoryPhi *createMemoryPhi(BasicBlock *BB); template MemoryUseOrDef *createNewAccess(Instruction *, AliasAnalysisType *, diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index e728a5f998f4..f0d27e0b2c6b 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1817,23 +1817,6 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I, return MUD; } -/// Returns true if \p Replacer dominates \p Replacee . -bool MemorySSA::dominatesUse(const MemoryAccess *Replacer, - const MemoryAccess *Replacee) const { - if (isa(Replacee)) -return DT->dominates(Replacer->getBlock(), Replacee->getBlock()); - const auto *MP = cast(Replacee); - // For a phi node, the use occurs in the predecessor block of the phi node. - // Since we may occur multiple times in the phi node, we have to check each - // operand to ensure Replacer dominates each operand where Replacee occurs. - for (const Use &Arg : MP->operands()) { -if (Arg.get() != Replacee && -!DT->dominates(Replacer->getBlock(), MP->getIncomingBlock(Arg))) - return false; - } - return true; -} - /// Properly remove \p MA from all of MemorySSA's lookup tables. void MemorySSA::removeFromLookups(MemoryAccess *MA) { assert(MA->use_empty() && ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] e3d3dbd - [llvm] Ensure newlines at the end of files (NFC)
Author: Kazu Hirata Date: 2021-01-10T09:24:57-08:00 New Revision: e3d3dbd33930b7bc879b522d65f6d27c1677253e URL: https://github.com/llvm/llvm-project/commit/e3d3dbd33930b7bc879b522d65f6d27c1677253e DIFF: https://github.com/llvm/llvm-project/commit/e3d3dbd33930b7bc879b522d65f6d27c1677253e.diff LOG: [llvm] Ensure newlines at the end of files (NFC) This patch eliminates pesky "No newline at end of file" messages from git diff. Added: Modified: llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h llvm/include/llvm/Analysis/MLInlineAdvisor.h llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp llvm/lib/CodeGen/LiveIntervalCalc.cpp llvm/lib/Target/AArch64/AArch64InstrGISel.td llvm/lib/Target/Mips/MipsInstrInfo.cpp llvm/lib/Target/PowerPC/PPCCCState.cpp Removed: diff --git a/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h b/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h index a39c4e5413d8d..a5f96e72ce978 100644 --- a/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h +++ b/llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h @@ -83,4 +83,4 @@ class FunctionPropertiesPrinterPass }; } // namespace llvm -#endif // LLVM_FUNCTIONPROPERTIESANALYSIS_H_ \ No newline at end of file +#endif // LLVM_FUNCTIONPROPERTIESANALYSIS_H_ diff --git a/llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h b/llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h index 5fc919a6dc56f..ab2cf52494c01 100644 --- a/llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h +++ b/llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h @@ -42,4 +42,4 @@ class InlineSizeEstimatorAnalysisPrinterPass PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; } // namespace llvm -#endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H \ No newline at end of file +#endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index cbe3b1f1f4e6e..5dedef06f53db 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -104,4 +104,4 @@ class MLInlineAdvice : public InlineAdvice { } // namespace llvm -#endif // LLVM_ANALYSIS_MLINLINEADVISOR_H \ No newline at end of file +#endif // LLVM_ANALYSIS_MLINLINEADVISOR_H diff --git a/llvm/include/llvm/Target/CGPassBuilderOption.h b/llvm/include/llvm/Target/CGPassBuilderOption.h index 13b8e68b75a30..c3a221e01ceb7 100644 --- a/llvm/include/llvm/Target/CGPassBuilderOption.h +++ b/llvm/include/llvm/Target/CGPassBuilderOption.h @@ -62,4 +62,4 @@ CGPassBuilderOption getCGPassBuilderOption(); } // namespace llvm -#endif // LLVM_CODEGEN_PASSBUILDER_OPTION_H \ No newline at end of file +#endif // LLVM_CODEGEN_PASSBUILDER_OPTION_H diff --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp index b6ff27dcaf55a..33519038e2259 100644 --- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp +++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp @@ -85,4 +85,4 @@ FunctionPropertiesPrinterPass::run(Function &F, FunctionAnalysisManager &AM) { << "\n"; AM.getResult(F).print(OS); return PreservedAnalyses::all(); -} \ No newline at end of file +} diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index 61b2611866f2c..bd0f2ec6b4ffa 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -6246,4 +6246,4 @@ LegalizerHelper::LegalizeResult LegalizerHelper::lowerSelect(MachineInstr &MI) { MIRBuilder.buildOr(DstReg, NewOp1, NewOp2); MI.eraseFromParent(); return Legalized; -} \ No newline at end of file +} diff --git a/llvm/lib/CodeGen/LiveIntervalCalc.cpp b/llvm/lib/CodeGen/LiveIntervalCalc.cpp index e8fd069d17a0a..2756086cb8b1a 100644 --- a/llvm/lib/CodeGen/LiveIntervalCalc.cpp +++ b/llvm/lib/CodeGen/LiveIntervalCalc.cpp @@ -202,4 +202,4 @@ void LiveIntervalCalc::extendToUses(LiveRange &LR, Register Reg, // reading Reg multiple times. That is OK, extend() is idempotent. extend(LR, UseIdx, Reg, Undefs); } -} \ No newline at end of file +} diff --git a/llvm/lib/Target/AArch64/AArch64InstrGISel.td b/llvm/lib/Target/AArch64/AArch64InstrGISel.td index ec7817beaeb84..430155c52302e 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrGISel.td +++ b/llvm/lib/Target/AArch64/AArch64InstrGISel.td @@ -167,4 +167,4 @@ def : GINodeEquiv; // These are patterns that we only use for GlobalISel via the importer. def : Pat<(f32 (fadd (vector_extract (v2f32 FPR64:$Rn), (i64 0)), (vector_extract (v2f32 FPR64:$Rn), (i
[llvm-branch-commits] [llvm] 407b1e6 - [StringExtras] Add a helper class for comma-separated lists
Author: Kazu Hirata Date: 2021-01-10T14:32:02-08:00 New Revision: 407b1e65a464081e28c325273b65e8eafdfad1d4 URL: https://github.com/llvm/llvm-project/commit/407b1e65a464081e28c325273b65e8eafdfad1d4 DIFF: https://github.com/llvm/llvm-project/commit/407b1e65a464081e28c325273b65e8eafdfad1d4.diff LOG: [StringExtras] Add a helper class for comma-separated lists This patch introduces a helper class SubsequentDelim to simplify loops that generate a comma-separated lists. For example, consider the following loop, taken from llvm/lib/CodeGen/MachineBasicBlock.cpp: for (auto I = pred_begin(), E = pred_end(); I != E; ++I) { if (I != pred_begin()) OS << ", "; OS << printMBBReference(**I); } The new class allows us to rewrite the loop as: SubsequentDelim SD; for (auto I = pred_begin(), E = pred_end(); I != E; ++I) OS << SD << printMBBReference(**I); where SD evaluates to the empty string for the first time and ", " for subsequent iterations. Unlike interleaveComma, defined in llvm/include/llvm/ADT/STLExtras.h, SubsequentDelim can accommodate a wider variety of loops, including: - those that conditionally skip certain items, - those that need iterators to call getSuccProbability(I), and - those that iterate over integer ranges. As an example, this patch cleans up MachineBasicBlock::print. Differential Revision: https://reviews.llvm.org/D94377 Added: Modified: llvm/include/llvm/ADT/StringExtras.h llvm/lib/CodeGen/MachineBasicBlock.cpp llvm/unittests/ADT/StringExtrasTest.cpp Removed: diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index 77288f8514dc..1fea700efe0c 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/include/llvm/ADT/StringExtras.h @@ -462,6 +462,30 @@ inline std::string join_items(Sep Separator, Args &&... Items) { return Result; } +/// A helper class to return the specified delimiter string after the first +/// invocation of operator StringRef(). Used to generate a comma-separated +/// list from a loop like so: +/// +/// \code +/// SubsequentDelim SD; +/// for (auto &I : C) +/// OS << SD << I.getName(); +/// \end +class SubsequentDelim { + bool First = true; + StringRef Delim; + + public: + SubsequentDelim(StringRef Delim = ", ") : Delim(Delim) {} + operator StringRef() { +if (First) { + First = false; + return {}; +} +return Delim; + } +}; + } // end namespace llvm #endif // LLVM_ADT_STRINGEXTRAS_H diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 14a270f994b4..c7b404e075e1 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -353,11 +353,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; // Don't indent(2), align with previous line attributes. OS << "; predecessors: "; -for (auto I = pred_begin(), E = pred_end(); I != E; ++I) { - if (I != pred_begin()) -OS << ", "; - OS << printMBBReference(**I); -} +SubsequentDelim SD; +for (auto *Pred : predecessors()) + OS << SD << printMBBReference(*Pred); OS << '\n'; HasLineAttributes = true; } @@ -366,10 +364,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; // Print the successors OS.indent(2) << "successors: "; +SubsequentDelim SD; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { - if (I != succ_begin()) -OS << ", "; - OS << printMBBReference(**I); + OS << SD << printMBBReference(**I); if (!Probs.empty()) OS << '(' << format("0x%08" PRIx32, getSuccProbability(I).getNumerator()) @@ -378,11 +375,10 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (!Probs.empty() && IsStandalone) { // Print human readable probabilities as comments. OS << "; "; + SubsequentDelim SD; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { const BranchProbability &BP = getSuccProbability(I); -if (I != succ_begin()) - OS << ", "; -OS << printMBBReference(**I) << '(' +OS << SD << printMBBReference(**I) << '(' << format("%.2f%%", rint(((double)BP.getNumerator() / BP.getDenominator()) * 100.0 * 100.0) / @@ -399,12 +395,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; OS.indent(2) << "liveins: "; -bool First = true; +SubsequentDelim SD; for (const auto &LI : liveins()) { - if (!First) -OS << ", "; - First = false; - OS << printReg(LI.PhysReg, TRI); + OS << SD << printReg(LI.PhysReg, TRI); if (!LI.LaneMask.all