[llvm] [SCEV] Avoid redundant stack push/pop in createSCEVIter (PR #199352)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 03:59:55 PDT 2026


================
@@ -7726,10 +7727,10 @@ const SCEV *ScalarEvolution::createSCEVIter(Value *V) {
 
     if (CreatedSCEV) {
       insertValueToMap(CurV, CreatedSCEV);
+      Stack.pop_back();
     } else {
-      // Queue CurV for SCEV creation, followed by its's operands which need to
-      // be constructed first.
-      Stack.emplace_back(CurV, true);
+      // Queue its's operands which need to be constructed.
----------------
nikic wrote:

```suggestion
      // Queue its operands which need to be constructed.
```
I also thing this comment should be one line down, above the for loop.

https://github.com/llvm/llvm-project/pull/199352


More information about the llvm-commits mailing list