<div dir="ltr"><div><div><div><div><div>Hi,<br></div>I have an SelDAG visitor function that will transform an ISD::AND (if its inputs are both ISD::SETCC) into a bunch of target specific code. The transformation passes double bootstrap with full lit/lnt testing but I have one failure in a small benchmark that I have narrowed down to one instance of the transformation (selection). And it looks somewhat strange for me.<br><br></div>Namely, one of the ISD::SETCC nodes has an input that is a CopyFromReg that appears after the `callseq_end` node. After I select this to the target specific code, that CopyFromReg (along with all the target specific code) moves up past the `callseq_end` node (so that it's within the callseq_begin/callseq_end pair). Now I don't know whether these nodes are supposed to be some kind of barriers thereby making this hoisting illegal. I'd appreciate some guidance on this (even if it is to just say this is perfectly legal and is not the source of my bug).<br><br></div>Here's the before and after SDAG dump.<br></div>Before:<br><span style="font-family:monospace,monospace">...<br>        t50: ch = CopyToReg t0, Register:i32 %vreg54, t48<br>        t60: ch,glue = callseq_end t59, TargetConstant:i64<32>, TargetConstant:i64<0>, t59:1<br>      t68: ch = TokenFactor t50, t60<br>          t62: i32,ch = CopyFromReg t0, Register:i32 %vreg19<br>        t64: i1 = setcc t62, t48, setlt:ch<br>        t53: i1 = setcc t48, Constant:i32<-50000>, setne:ch<br>      t65: i1 = and t64, t53<br>    t74: ch = br_cc t68, setne:ch, t65, Constant:i1<-1>, BasicBlock:ch<while.cond.outer 0x100137faf30></span><br><br></div>After:<span style="font-family:monospace,monospace"><br>...<br>                  t77: i32 = EXTSW_32 t48<br>                    t62: i32,ch = CopyFromReg t0, Register:i32 %vreg19<br>                  t76: i32 = EXTSW_32 t62<br>                t78: i32 = SUBF t77, t76<br>              t81: i32 = RLDICL_32 t78, TargetConstant:i64<1>, TargetConstant:i64<63><br>            t91: i64 = INSERT_SUBREG IMPLICIT_DEF:i64, t81, TargetConstant:i32<1><br>                    t82: i32 = XOR t48, Constant:i32<-50000><br>                  t83: i32 = CNTLZW t82<br>                t87: i32 = RLWINM t83, TargetConstant:i32<27>, TargetConstant:i32<5>, TargetConstant:i32<31><br>              t89: i32 = XORI t87, TargetConstant:i32<1><br>            t92: i64 = INSERT_SUBREG IMPLICIT_DEF:i64, t89, TargetConstant:i32<1><br>          t94: i64,glue = AND8o t91, t92<br>        t96: i1 = EXTRACT_SUBREG Register:i32 %CR0, TargetConstant:i32<4>, t94:1<br>      t75: i1 = CRXOR t96, Constant:i1<-1><br>        t50: ch = CopyToReg t0, Register:i32 %vreg54, t48<br>        t60: ch,glue = callseq_end t59, TargetConstant:i64<32>, TargetConstant:i64<0>, t59:1<br>      t68: ch = TokenFactor t50, t60<br>    t74: ch = BC t75, BasicBlock:ch<while.cond.outer 0x100137faf30>, t68</span><br></div>