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? | |
181 | llvm::drop_begin ? | |
194–195 | 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 | ||
---|---|---|
194–195 |
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) | |
194–195 |
(at least not easily) | |
202 | You could use eraseIndices.find_first() to get the first removed argument. |
mlir/lib/IR/Block.cpp | ||
---|---|---|
202 | 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.