[llvm] [SDAG] Construct constants via instructions if materialization is costly (PR #86659)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 22:41:51 PDT 2024


wangpc-pp wrote:

> > > Really not sure about this - why not just use custom lowering in the RISCV target?
> > 
> > 
> > I was thinking that maybe other targets can benefit from this.
> 
> Generic costs driven folds inside the DAG can get very difficult (how to compare them, quality of cost tables, different targets have different cost scales + thresholds, etc.) - I'd much prefer to see this just in RISCV (keep the costs system if you like). But really we should be considering better ways to ensure we reuse/rematerialize constants in a general manner, although I'd probably expect that to be later in ISelDAGToDAG etc.

Thanks! I will move this optimization to RISCV.
This PR shows other targets can benefit from it at least.

https://github.com/llvm/llvm-project/pull/86659


More information about the llvm-commits mailing list