[PATCH] D46276: [CostModel][X86] Derive TTI costs from complete scheduling models (PR36550) (RFC)

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 06:32:28 PDT 2018


andreadb added a comment.

Hi Simon,



================
Comment at: utils/TableGen/SubtargetEmitter.cpp:1634-1645
+      for (unsigned I = 0, E = SC.Transitions.size(); I != E; ++I) {
+        const CodeGenSchedTransition &T = SC.Transitions[I];
         if (PI != 0 && !count(T.ProcIndices, PI))
           continue;
         PE.setIndentLevel(3);
-        emitPredicates(T, SchedModels.getSchedClass(T.ToClassIdx), PE, OS);
+        bool ShouldEmitNullCheck = I != E - 1;
+        // Always emit a null check on the input machine instruction pointer
----------------
You don't need to worry about computing 'ShouldEmitNullCheck'.
The logic in `emitPredicates` already knows how to identify so-called "default" predicates (i.e. predicates that always evaluate to 'true').

Note that you can only get to line 1501 in `emitPredicates` if there is at least one non-default predicate in the sequence of checks. Default predicate are then skipped by the loop coming after that line.

So, I think that you can safely remove all this code, as well as extra argument `emitNullCheck` from `emitPredicates()`, and simply change the following two lines:

Line 1501:
```
SS << "if " << "(MI && (";
```

Line 1530:
```
SS << "))\n"; // end of if-stmt
```

If my understanding is correct, this should be enough to achieve your goal.


Repository:
  rL LLVM

https://reviews.llvm.org/D46276





More information about the llvm-commits mailing list