-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
llvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
In https://reviews.llvm.org/D88783, we fold or(shl(a,x),lshr(b,sub(bw,x))) -> fshl(a,b,x) iff x < bw. This constraint on shamts is added to avoid redundant and x, 2^bw - 1 in the codegen. However, this may increase the complexity of ISel and produce inefficient code. See an example from https://github.com/cyyself/hwprobe/blob/master/ifunc_example/ror32.c: https://godbolt.org/z/fxEb1f65h.
To address this issue, we can add attribute range(iN 0, N) to the shamt in InstCombine. Then we use assertzext in SelectionDAGBuilder to eliminate unnecessary and insts.
Looking forward to your inputs.
cc @nikic @topperc @RKSimon @asb @preames @cyyself
RKSimon
Metadata
Metadata
Assignees
Labels
llvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization