This teaches the SCCP Solver about some of the constrained intrinsics by having them use the same codepaths as the non-constrained instructions.
Casting instructions along with the binary operators will come later.
Paths
| Differential D115737
[IPSCCP] Partial support for constrained intrinsics AbandonedPublic Authored by kpn on Dec 14 2021, 8:33 AM.
Details
Diff Detail Event Timelinefhahn added inline comments. This revision now requires changes to proceed.Dec 14 2021, 8:42 AM
Comment Actions Update for review comments. I've also reduced it down to just fcmp and fcmps having a functional impact. I don't have a good way to test the binary operators just yet. Comment Actions
Because ConstantFoldCall() is called from handleCallResult(), and we're skipping that part of handleCallBase() due to having constrained fcmp/fcmps behave just like the non-constrained. Instead we're constant folding in visitCmpInst(). Also, a constrained fcmp/fcmps is !isa<Function>, so while it is not overdefined, it does not fall into the block in markUsersAsChanged() that calls ConstantFoldCall(). I'll update the diff in a minute with the right set of tests... Comment Actions Rebase. Update to use more targeted tests. This still leaves fhahn's request not done because that's what D118392 is for. Comment Actions
Sorry, what I meant is: Why is this not handled by ConstantFoldCall() prior to your changes? There should be no need for special handling of these intrinsics here. From a cursory look, I think the problem is that handleCallOverdefined() doesn't deal with metadata operands. I expect that if you fix this, then constrained intrinsics will "just work".
Revision Contents
Diff 464756 llvm/lib/Transforms/Utils/SCCPSolver.cpp
llvm/test/Transforms/SCCP/strictfp-phis-fcmp.ll
llvm/test/Transforms/SCCP/strictfp-phis-fcmps.ll
|