[RISCV] Prevent constant hoisting for (and (shl X, C), mask<<C)
authorCraig Topper <craig.topper@sifive.com>
Tue, 22 Nov 2022 03:16:40 +0000 (19:16 -0800)
committerCraig Topper <craig.topper@sifive.com>
Tue, 22 Nov 2022 03:16:40 +0000 (19:16 -0800)
commita391b49ce8524ddb6283d6605544a354d187a9d4
tree2196db7a56191a343edfa232ecd9c172d8faf752
parent6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b
[RISCV] Prevent constant hoisting for (and (shl X, C), mask<<C)

If the immediate is a shifted mask, we will use a pair of shifts
and never materialize the immediate. Consider the immediate free.

Reviewed By: reames, luismarques

Differential Revision: https://reviews.llvm.org/D138260
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll