[llvm-dev] How do I prevent DAGCombiner from combining ZExt/SExt(load) into LoadZExt?

Zhang via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 7 02:10:09 PST 2021


Thanks. I've already called:
```
for (MVT VT : {MVT::i32, MVT::i64, MVT::i8}) {
    setLoadExtAction(ISD::EXTLOAD, VT, MVT::i1, Promote);
    setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i1, Expand);
    setLoadExtAction(ISD::ZEXTLOAD, VT, MVT::i1, Expand);
    setTruncStoreAction(MVT::i1, VT, Promote);
}

```
 
which still gets me:
```
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

```
 
Not sure what I'm missing here
------------------ Original ------------------
From:  "Tim Northover"<t.p.northover at gmail.com>;
Date:  Wed, Jan 6, 2021 10:27 PM
To:  "Zhang"<admin at mayuyu.io>; 
Cc:  "llvm-dev"<llvm-dev at lists.llvm.org>; 
Subject:  Re: [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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210107/76bbbc14/attachment.html>


More information about the llvm-dev mailing list