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
Event Timeline
llvm/lib/Analysis/LazyValueInfo.cpp | ||
---|---|---|
1290 | Wouldn't we expect such a freeze to get dropped by InstSimplify/InstCombine anyway? |
llvm/lib/Analysis/LazyValueInfo.cpp | ||
---|---|---|
1290 | 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 | ||
---|---|---|
1290 | 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 | ||
---|---|---|
1290 | Would it be the right direction if I implement this optimization in InstCombine instead? |
llvm/lib/Analysis/LazyValueInfo.cpp | ||
---|---|---|
1290 | 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 | ||
---|---|---|
1290 | The check seemed redundant to me as well, so removed it. The unit tests still work too. |
Wouldn't we expect such a freeze to get dropped by InstSimplify/InstCombine anyway?