This avoids linear search in BlockArgument::getArgNumber().
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/IR/Value.h | ||
---|---|---|
287 | The comment here is off. | |
288 | Can you make this private? Block is already a friend. | |
mlir/lib/IR/Block.cpp | ||
161 | + index + 1? The argument at index should already have its index set. Also, llvm::drop_begin instead? | |
179 | llvm::drop_begin ? | |
196 | Using eraseArgument here is going to result in updating the indices multiple times. Also can you merge indice updates into this loop? |
mlir/lib/IR/Block.cpp | ||
---|---|---|
196 |
Good point!
I'm not sure how though: the loop is going backward, you can't know on the first element you're deleting what its final index will be? |
mlir/lib/IR/Block.cpp | ||
---|---|---|
160 | nit: ++index; (You could also merge it into the drop_begin call) | |
196 |
(at least not easily) | |
208 | You could use eraseIndices.find_first() to get the first removed argument. |
mlir/lib/IR/Block.cpp | ||
---|---|---|
208 | Updated, but I'm not totally sure it's better for the common case: the code in find_first is not trivial compared to the vector traversal here. |
The comment here is off.