The fold currently only handles rotation patterns, but with the maturation of backend funnel shift handling we can now realistically handle all funnel shift patterns.
This should allow us to begin resolving PR46896 et al.
Paths
| Differential D90625
[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel shifts ClosedPublic Authored by RKSimon on Nov 2 2020, 9:42 AM.
Details Summary The fold currently only handles rotation patterns, but with the maturation of backend funnel shift handling we can now realistically handle all funnel shift patterns. This should allow us to begin resolving PR46896 et al.
Diff Detail
Event TimelineThis revision is now accepted and ready to land.Nov 2 2020, 1:35 PM This revision was landed with ongoing or failed builds.Nov 3 2020, 3:03 AM Closed by commit rG59b22e495c15: [AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic… (authored by RKSimon). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions Reopening because the patch was reverted. $ cat apedec-reduced.c a; b(e) { int c; unsigned d = f(); c = d >> 32 - e; return c; } g() { int h = i(); if (a) h = h << a | b(a); return h; } $ clang -target aarch64-linux-gnu -w -c -O3 apedec-reduced.c clang: ../lib/Transforms/InstCombine/InstructionCombining.cpp:3656: bool llvm::InstCombinerImpl::run(): Assertion `DT.dominates(BB, UserParent) && "Dominance relation broken?"' failed. This revision is now accepted and ready to land.Nov 4 2020, 5:28 AM Comment Actions Ensure we block poison in a funnel shift value - similar to rG0fe91ad463fea9d08cbcd640a62aa9ca2d8d05e0 This revision is now accepted and ready to land.Dec 20 2020, 3:30 AM Comment Actions The original, unreduced testcase seems to work fine now at least - thanks! Can't really comment on the code itself though. Comment Actions LGTM - the only diff from the earlier rev is that we now check the dominator tree to confirm that the shift ops are safe to hoist. This revision is now accepted and ready to land.Dec 21 2020, 6:19 AM Closed by commit rG88c5b5006064: [AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic… (authored by RKSimon). · Explain WhyDec 21 2020, 7:23 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 302528 llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
llvm/test/Transforms/AggressiveInstCombine/funnel.ll
llvm/test/Transforms/AggressiveInstCombine/rotate.ll
|
This does fold to a funnel shift (see rotate.ll) - not sure whether its worth keeping or not.