Details
- Reviewers
aeubanks arsenm asbirlea ychen lebedev.ri
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | ||
---|---|---|
280 | Copied from here. |
This is missing description and test coverage.
Why is this NPM specific?
The specific folds should be guarded with that F.hasFnAttribute(Attribute::OptForFuzzing) check i think.
Right. But why is this PM-specific at all, why aren't the folds themselves guarded with that?
Oh I see, maybe we don't even need SimplifyCondBranch and FoldTwoEntryPHINode in SimplifyCFGOptions, just check for the OptForFuzzing attribute at time of use.
It's from here: https://github.com/llvm/llvm-project/commit/cdd006eec9409923f9a56b9026ce2cb72e7b71dc. It was guarded by FoldTwoEntryPHINode and simplifyCondBranch.
As the commit message said, "This should function as any other SimplifyCFGOption rather than having
the transform check and specially consider the attribute itself.". I think it was intended to have SimplifyCFGOptions as a control for SimplifyCondBranch and FoldTwoEntryPHINode.
I think the transforms themselves should be explicitly guarded with !F.hasFnAttribute(Attribute::OptForFuzzing),
but i don't feel strongly about it..
I'd say either revert https://github.com/llvm/llvm-project/commit/cdd006eec9409923f9a56b9026ce2cb72e7b71dc, or in FoldTwoEntryPHINode() check that the option is set and that the OptForFuzzing attribute is not set (same with simplifyCondBranch()). I guess I'd slightly prefer the second option as to not totally revert the original commit.
Why do we want to check the option and not OptForFuzzing? Doesn't they have the same truth value?
As of right now, yes, but the point of https://github.com/llvm/llvm-project/commit/cdd006eec9409923f9a56b9026ce2cb72e7b71dc was that in the future, some consumer of simplifyCFG() may want to set those options. I'm not against a complete revert of that change, but it does sort of make sense.
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | ||
---|---|---|
248–251 | Then this is pretty much the same as reverting the original commit. And Line 280-286 wouldn't be necessary either (LPM pass). |
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | ||
---|---|---|
248–251 | This would allow turning off SimplifyCondBranch and FoldTwoEntryPHINode, but otherwise yes. Maybe we should just revert with arsenm's approval. |
the changes in this file shouldn't be necessary any more