This patch makes getEdgeValueLocal more precise when a freeze instruction is
given, by adding support for freeze into constantFoldUser
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
| Time | Test | |
|---|---|---|
| 130 ms | linux > Polly.ScopInfo::Unknown Unit Message ("") | 
Event Timeline
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | Wouldn't we expect such a freeze to get dropped by InstSimplify/InstCombine anyway? | |
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | You mean, we should rewrite uses of a freeze in blocks where we know the operand of the freeze can't be undef/poison? I guess that's something we should do. I don't think instsimplify has the context necessary to do that sort of rewrite. | |
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | You're right, if there are multiple uses and only some are dominated by the condition we currently don't handle it in InstCombine. The @simple case from the test would be handled though, because the freeze gets sunk. | |
getEdgeValueLocal's change at if (BranchInst *BI ...) { .. } corresponds to the simple example.
For the switch example, if (SwitchInst *SI ...) { ... } branch calls constantFoldUser, which is newly updated.
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | Would it be the right direction if I implement this optimization in InstCombine instead? | |
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | Is this code actually needed? I'm thinking that the constantFoldUser code should already take care of it. The Freeze usesOperand Condition, and should then get folded. | |
| llvm/lib/Analysis/LazyValueInfo.cpp | ||
|---|---|---|
| 1316 | The check seemed redundant to me as well, so removed it. The unit tests still work too. | |
clang-format not found in user's PATH; not linting file.