[llvm-dev] [isel] OPC_EmitMergeInputChains failure on intrinsic lowering.

Dominique Torette via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 10 01:57:17 PDT 2018


Hi,



I'm still missing something on the operations used by the DAG Pattern ISel state machine, in particular operations like  'OPC_EmitMergeInputChains'.

I've define an architecture specific intrinsic mapping to the target NOP operation, like this:



def         : Pat<(int_clp_nop),       (NOP)>;



In many 'contexts', it works perfectly. But prior to 'TokenFactor' it fails as in following example:



Total amount of phi nodes to update: 2

Node 0 : (0x31d8508, 2147483651)

Node 1 : (0x31d8568, 2147483652)

Initial selection DAG: BB#1 '_start:while.body'

SelectionDAG has 24 nodes:

  t0: ch = EntryToken

  t4: i32,ch = CopyFromReg t0, Register:i32 %vreg1

    t12: i32,ch = CopyFromReg t0, Register:i32 %vreg0

  t13: i32 = add t12, t4

        t15: ch = CopyToReg t0, Register:i32 %vreg2, t13

                t5: ch = llvm.clp.writeapb.i32 t0, TargetConstant:i16<398>, Constant:i32<24574>, t4

              t7: ch = llvm.clp.nop t5, TargetConstant:i16<390>

            t8: ch = llvm.clp.nop t7, TargetConstant:i16<390>

          t9: ch = llvm.clp.nop t8, TargetConstant:i16<390>

        t10: ch = llvm.clp.nop t9, TargetConstant:i16<390>

      t20: ch = TokenFactor t15, t10

      t18: i1 = setcc t13, Constant:i32<100>, setlt:ch

    t21: ch = brcond t20, t18, BasicBlock:ch<while.body 0x31d8458>

  t23: ch = br t21, BasicBlock:ch<while.end 0x31d85c8>



Selecting: t20: ch = TokenFactor t15, t10



Selecting: t10: ch = llvm.clp.nop t9, TargetConstant:i16<390>



ISEL: Starting pattern match on root node: t10: ch = llvm.clp.nop t9, TargetConstant:i16<390>



  Initial Opcode index to 5

  Skipped scope entry (due to false predicate) at index 8, continuing at 44

  Skipped scope entry (due to false predicate) at index 45, continuing at 68

  Skipped scope entry (due to false predicate) at index 69, continuing at 92

  Skipped scope entry (due to false predicate) at index 93, continuing at 116

  Match failed at index 120

  Continuing at 127

  Match failed at index 128

...

LLVM ERROR: Cannot select: intrinsic %llvm.clp.nop

------



I was expecting a match and a morphing to CLP::NOP at line 121.

While investigating the cause in the SelectCode MatcherTable[], it fails on 'OPC_emitMergInputsChains'.

While viewing the dag-combine1-dags graph, the TokenFactor has two chains (blue dashed lines).

Is it the cause of the failure? Why such TokenFactor are introduced? Where/how are they removed?

Do I have to define something else in my Pattern<> or in the NOP Instruction<>?



------
/*116*/       /*Scope*/ 10, /*->127*/
/*117*/         OPC_CheckChild1Integer, 6|128,3/*390*/,
/*120*/         OPC_EmitMergeInputChains1_0,
/*121*/         OPC_MorphNodeTo, TARGET_VAL(CLP::NOP), 0|OPFL_Chain,
                    0/*#VTs*/, 0/*#Ops*/,
                // Src: (intrinsic_void 390:iPTR) - Complexity = 8
                // Dst: (NOP)



TIA,        Dominique T.



Dominique Torette

System Architect

Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur

Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20

www.spacebel.be







 ------------------------------------------------------------------------------

E-MAIL DISCLAIMER

The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.
 -------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/3e27c6b0/attachment.html>


More information about the llvm-dev mailing list