SimplifyCFG expects to be able to cast both sides to an int, if either side can be case to an int, but this is not desirable or legal, in general, per D104547.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SimplifyCFG/nonintegral.ll | ||
---|---|---|
3 | Explicit verify is unnecessary. First RUN line can be dropped, they do the same thing. Please use update_test_checks.py. |
run tests once
llvm/test/Transforms/SimplifyCFG/nonintegral.ll | ||
---|---|---|
3 | I used update_test_checks.py to generate these tests, but disliked the results, and edited them to the form here. Has policy changed such that it is now required to be used verbatim? |
LG
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
478 | I realize that this is pre-existing, but I found the code structure here somewhat confusing. I think it would be more obvious to write this as two separate checks: // Normal constant int. if (auto *CI = dyn_cast<ConstantInt>(V)) return CI; // Only handle constant integral pointers in the following. if (!isa<Constant>(V) || !V->getType()->isPointerTy() || DL.isNonIntegralPointerType(V->getType())) return nullptr; | |
llvm/test/Transforms/SimplifyCFG/nonintegral.ll | ||
3 | Yes, auto-generated check lines are preferred. If you want to make it more explicit what this test is about, maybe add a comment? ; Check that ptrtoint is not produced for non-integral address spaces. | |
6 | The local_unnamed_addr #0 bit can be dropped. |
llvm/test/Transforms/SimplifyCFG/nonintegral.ll | ||
---|---|---|
3 | That seems to be at odds with both the testing guide (which implies it is optional) https://llvm.org/docs/TestingGuide.html#generating-assertions-in-regression-tests |
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
478 | I agree, if it was newly written, but also wasn't sure it warranted rearrangement, which would complicate the PR diff |
I realize that this is pre-existing, but I found the code structure here somewhat confusing. I think it would be more obvious to write this as two separate checks: