Check if the operation is already in the worklist before adding it.

PiperOrigin-RevId: 225379496
This commit is contained in:
River Riddle 2018-12-13 09:00:06 -08:00 committed by jpienaar
parent 4860f0e8fd
commit 5c4f1fdd42
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ public:
void simplifyFunction(Function *currentFunction, WorklistRewriter &rewriter);
void addToWorklist(Operation *op) {
// Check to see if the worklist already contains this op.
if (worklistMap.count(op))
return;
worklistMap[op] = worklist.size();
worklist.push_back(op);
}