In case all predecessor go to a single successor of current BB. We want to fold (not thread).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1273 ↗ | (On Diff #91482) | If you are going to check predecessors a bunch, please use the prediteratorcache to cache the size. |
lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1273 ↗ | (On Diff #91482) | I think thats a good suggestion. There are a few places we get the predecessors of the block currently being processed, we could use a PredIterCache for them. But I prefer to put it in as another commit. |
Gentle Ping.
lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1273 ↗ | (On Diff #91482) | dberlin is doing experiment about preditercache. I will rewrite this part if needed when that is done in another commit. |
Comments inline.
lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1285 ↗ | (On Diff #93651) | This logic looks like it isn't tested? In any case, I'd suggest not putting it in this first patch, but doing it as an improvement on the fold-instead-of-threading logic. |
test/Transforms/JumpThreading/basic.ll | ||
21 ↗ | (On Diff #93651) | Can you please add a test case with multiple preds of L0? |
lgtm with nits
lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1294 ↗ | (On Diff #95666) | s/dont/don't |
1299 ↗ | (On Diff #95666) | In this case, it may be cleaner to write the loop as: for (BasicBlock *SuccBB : successors(BB)) if (SuccBB != OnlyDest) SuccBB->removePredecessor(BB, true); // Unreachable successor |