These don't always get folded because when the instructions are created the constants are obscured by artifacts, or other reasons.
Use it AArch64 post-legal combiner too.
Differential D106776
[GlobalISel] Add a constant folding combine. aemerson on Jul 25 2021, 3:10 PM. Authored by
Details These don't always get folded because when the instructions are created the constants are obscured by artifacts, or other reasons. Use it AArch64 post-legal combiner too.
Diff Detail
Event Timeline
Comment Actions Add a variant of replaceInstWithConstant taking APInt. It still seems convenient to have an int64_t version since that one builds the constant with the type of the DstOp, while we'd have to construct a correctly sized APInt in each call site if we replaced it. Comment Actions
For the AMDGPU fshl/fshr tests, the reason is that the foldable instructions are created during legalization, and the AMDGPU legalizer doesn't use CSEMIRBuilder yet. Comment Actions Scratch that. The reason is that the constants are obscured by artifacts like G_ZEXT, which we don't constant fold (I previously tried that in D89392). |