Zhang via llvm-dev
2021-Jan-06 03:51 UTC
[llvm-dev] How do I prevent DAGCombiner from combining ZExt/SExt(load) into LoadZExt?
In our toy ISA, we don't have a dedicated ZExtLoad instruction. However DAGCombiner tends to combine ZERO_EXTEND(LOAD) into a LoadZExt node which can't be trivially selected: ``` Combining: t5: i32 = zero_extend t4 Creating new node: t9: i32,ch = load<(dereferenceable load 1 from %ir.2), zext from i1> t0, FrameIndex:i64<0>, undef:i64 ``` Reading through the implementation of ``tryToFoldExtOfLoad`` is still equally confusing -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210106/fc7fcc67/attachment.html>
Tim Northover via llvm-dev
2021-Jan-06 14:26 UTC
[llvm-dev] How do I prevent DAGCombiner from combining ZExt/SExt(load) into LoadZExt?
Hi Zhang, On Wed, 6 Jan 2021 at 03:51, Zhang via llvm-dev <llvm-dev at lists.llvm.org> wrote:> In our toy ISA, we don't have a dedicated ZExtLoad instruction. However DAGCombiner tends to combine ZERO_EXTEND(LOAD) into a LoadZExt node which can't be trivially selected:I think you control that with a call to TargetLowering::setLoadExtAction in XYZTargetLowering. Cheers. Tim.