diff options
author | Craig Topper <craig.topper@sifive.com> | 2025-03-11 09:21:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 09:21:10 -0700 |
commit | 146ef7a5f44af68e969dfb66918ae49810864aec (patch) | |
tree | 5aa525f6950ec3c11157675d8f2df46f3f1b5fab /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | |
parent | 83ec179fc8b44ae23a0bfe51073d5ce75155639e (diff) | |
download | llvm-146ef7a5f44af68e969dfb66918ae49810864aec.zip llvm-146ef7a5f44af68e969dfb66918ae49810864aec.tar.gz llvm-146ef7a5f44af68e969dfb66918ae49810864aec.tar.bz2 |
[TableGen] Remove unnecessary const_cast and use range-based for loops. NFC (#130717)
In order to use a range-based loop, I reduced a needed const_cast to
only the one line that needed it.
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index 59148a9..ed3ec92 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -4139,23 +4139,19 @@ void CodeGenDAGPatterns::InferInstructionFlags() { // If requested by the target, guess any undefined properties. if (Target.guessInstructionProperties()) { - for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { - CodeGenInstruction *InstInfo = - const_cast<CodeGenInstruction *>(Instructions[i]); + for (const CodeGenInstruction *InstInfo : Instructions) { if (InstInfo->InferredFrom) continue; // The mayLoad and mayStore flags default to false. // Conservatively assume hasSideEffects if it wasn't explicit. if (InstInfo->hasSideEffects_Unset) - InstInfo->hasSideEffects = true; + const_cast<CodeGenInstruction *>(InstInfo)->hasSideEffects = true; } return; } // Complain about any flags that are still undefined. - for (unsigned i = 0, e = Instructions.size(); i != e; ++i) { - CodeGenInstruction *InstInfo = - const_cast<CodeGenInstruction *>(Instructions[i]); + for (const CodeGenInstruction *InstInfo : Instructions) { if (InstInfo->InferredFrom) continue; if (InstInfo->hasSideEffects_Unset) |