On Wed, Dec 03, 2014 at 06:17:32PM +0200, Heikki Kultala
wrote:> After upgrading to llvm 3.6-svn I keep getting
>
>
> LLVM ERROR: Cannot select: 0x10d3a88: i32,glue = adde 0x12cf3a8,
> 0x1d0e708, 0x1c5ee08:1 [ORD=23] [ID=48]
> 0x12cf3a8: i32,ch = CopyFromReg 0xda2310, 0x1c5f438 [ORD=3] [ID=26]
> 0x1c5f438: i32 = Register %vreg15 [ID=4]
> 0x1d0e708: i32 = Constant<0> [ID=6]
> 0x1c5ee08: i32,glue = addc 0x14211c0, 0x2f599a8 [ORD=23] [ID=41]
> 0x14211c0: i32,ch = CopyFromReg 0x12cf3a8:1, 0x2f59ed0 [ORD=3] [ID=34]
> 0x2f59ed0: i32 = Register %vreg16 [ID=5]
> 0x2f599a8: i32 = Constant<16> [ID=12]
> In function: memcpy
>
>
> on our custom backend.
>
> Setting lowering to expand ADDE's does not seem to help:
>
> setOperationAction(ISD::ADDE, MVT::i32, Expand);
>
If you are marking ADDE as Expand, it shouldn't be emitted in
the first place. Try to find out where in lib/CodeGen/SelectionDAG the
ADDE node is being created. My guess is that there
is a missing legality check for ISD::ADDE somewhere.
-Tom>
>
> With older llvm versions these ADDE's never appear.
>
>
>
>
>
> The whole function is here, I don't understand where it could need
> adde operation. Pointers are 32-bit in this platform.
>
>
> ; Function Attrs: nounwind
> define internal fastcc void @memcpy(i8* %dst0, i8* %src0, i32 %len0) #1 {
> entry:
> %cmp = icmp ult i32 %len0, 16
> br i1 %cmp, label %while.cond17.preheader, label %land.lhs.true
>
> land.lhs.true: ; preds = %entry
> %0 = ptrtoint i8* %src0 to i32
> %1 = ptrtoint i8* %dst0 to i32
> %and43 = or i32 %0, %1
> %or = and i32 %and43, 3
> %tobool = icmp eq i32 %or, 0
> br i1 %tobool, label %while.body.lr.ph, label %while.body19.preheader
>
> while.body.lr.ph: ; preds = %land.lhs.true
> %2 = bitcast i8* %dst0 to i32*
> %3 = bitcast i8* %src0 to i32*
> %4 = add i32 %len0, -16
> %5 = and i32 %4, -16
> %6 = add i32 %5, 16
> %scevgep62 = getelementptr i8* %dst0, i32 %6
> br label %while.body
>
> while.cond10.preheader: ; preds = %while.body
> %scevgep64 = getelementptr i8* %src0, i32 %6
> %7 = sub i32 %4, %5
> %scevgep6263 = bitcast i8* %scevgep62 to i32*
> %scevgep6465 = bitcast i8* %scevgep64 to i32*
> %cmp1148 = icmp ugt i32 %7, 3
> br i1 %cmp1148, label %while.body12.lr.ph, label %while.end16
>
> while.body12.lr.ph: ; preds >
%while.cond10.preheader
> %8 = add i32 %7, -4
> %9 = lshr i32 %8, 2
> %10 = add nuw nsw i32 %9, 1
> br label %while.body12
>
> while.body: ; preds > %while.body,
%while.body.lr.ph
> %len.057 = phi i32 [ %len0, %while.body.lr.ph ], [ %sub, %while.body ]
> %aligned_src.056 = phi i32* [ %3, %while.body.lr.ph ], [
> %incdec.ptr8, %while.body ]
> %aligned_dst.055 = phi i32* [ %2, %while.body.lr.ph ], [
> %incdec.ptr9, %while.body ]
> %incdec.ptr = getelementptr inbounds i32* %aligned_src.056, i32 1
> %11 = load i32* %aligned_src.056, align 4, !tbaa !41
> %incdec.ptr3 = getelementptr inbounds i32* %aligned_dst.055, i32 1
> store i32 %11, i32* %aligned_dst.055, align 4, !tbaa !41
> %incdec.ptr4 = getelementptr inbounds i32* %aligned_src.056, i32 2
> %12 = load i32* %incdec.ptr, align 4, !tbaa !41
> %incdec.ptr5 = getelementptr inbounds i32* %aligned_dst.055, i32 2
> store i32 %12, i32* %incdec.ptr3, align 4, !tbaa !41
> %incdec.ptr6 = getelementptr inbounds i32* %aligned_src.056, i32 3
> %13 = load i32* %incdec.ptr4, align 4, !tbaa !41
> %incdec.ptr7 = getelementptr inbounds i32* %aligned_dst.055, i32 3
> store i32 %13, i32* %incdec.ptr5, align 4, !tbaa !41
> %incdec.ptr8 = getelementptr inbounds i32* %aligned_src.056, i32 4
> %14 = load i32* %incdec.ptr6, align 4, !tbaa !41
> %incdec.ptr9 = getelementptr inbounds i32* %aligned_dst.055, i32 4
> store i32 %14, i32* %incdec.ptr7, align 4, !tbaa !41
> %sub = add i32 %len.057, -16
> %cmp2 = icmp ugt i32 %sub, 15
> br i1 %cmp2, label %while.body, label %while.cond10.preheader
>
> while.body12: ; preds >
%while.body12, %while.body12.lr.ph
> %len.151 = phi i32 [ %7, %while.body12.lr.ph ], [ %sub15, %while.body12 ]
> %aligned_src.150 = phi i32* [ %scevgep6465, %while.body12.lr.ph ],
> [ %incdec.ptr13, %while.body12 ]
> %aligned_dst.149 = phi i32* [ %scevgep6263, %while.body12.lr.ph ],
> [ %incdec.ptr14, %while.body12 ]
> %incdec.ptr13 = getelementptr inbounds i32* %aligned_src.150, i32 1
> %15 = load i32* %aligned_src.150, align 4, !tbaa !41
> %incdec.ptr14 = getelementptr inbounds i32* %aligned_dst.149, i32 1
> store i32 %15, i32* %aligned_dst.149, align 4, !tbaa !41
> %sub15 = add i32 %len.151, -4
> %cmp11 = icmp ugt i32 %sub15, 3
> br i1 %cmp11, label %while.body12, label
> %while.cond10.while.end16_crit_edge
>
> while.cond10.while.end16_crit_edge: ; preds = %while.body12
> %16 = shl nuw i32 %9, 2
> %scevgep = getelementptr i32* %scevgep6263, i32 %10
> %17 = sub i32 %8, %16
> %scevgep61 = getelementptr i32* %scevgep6465, i32 %10
> br label %while.end16
>
> while.end16: ; preds >
%while.cond10.while.end16_crit_edge, %while.cond10.preheader
> %len.1.lcssa = phi i32 [ %17, %while.cond10.while.end16_crit_edge
> ], [ %7, %while.cond10.preheader ]
> %aligned_src.1.lcssa = phi i32* [ %scevgep61,
> %while.cond10.while.end16_crit_edge ], [ %scevgep6465,
> %while.cond10.preheader ]
> %aligned_dst.1.lcssa = phi i32* [ %scevgep,
> %while.cond10.while.end16_crit_edge ], [ %scevgep6263,
> %while.cond10.preheader ]
> %18 = bitcast i32* %aligned_dst.1.lcssa to i8*
> %19 = bitcast i32* %aligned_src.1.lcssa to i8*
> br label %while.cond17.preheader
>
> while.cond17.preheader: ; preds >
%while.end16, %entry
> %dst.0.ph = phi i8* [ %dst0, %entry ], [ %18, %while.end16 ]
> %src.0.ph = phi i8* [ %src0, %entry ], [ %19, %while.end16 ]
> %len.2.ph = phi i32 [ %len0, %entry ], [ %len.1.lcssa, %while.end16 ]
> %tobool1844 = icmp eq i32 %len.2.ph, 0
> br i1 %tobool1844, label %while.end22, label %while.body19.preheader
>
> while.body19.preheader: ; preds >
%while.cond17.preheader, %land.lhs.true
> %len.247.ph = phi i32 [ %len0, %land.lhs.true ], [ %len.2.ph,
> %while.cond17.preheader ]
> %src.046.ph = phi i8* [ %src0, %land.lhs.true ], [ %src.0.ph,
> %while.cond17.preheader ]
> %dst.045.ph = phi i8* [ %dst0, %land.lhs.true ], [ %dst.0.ph,
> %while.cond17.preheader ]
> br label %while.body19
>
> while.body19: ; preds >
%while.body19, %while.body19.preheader
> %len.247 = phi i32 [ %dec, %while.body19 ], [ %len.247.ph,
> %while.body19.preheader ]
> %src.046 = phi i8* [ %incdec.ptr20, %while.body19 ], [
> %src.046.ph, %while.body19.preheader ]
> %dst.045 = phi i8* [ %incdec.ptr21, %while.body19 ], [
> %dst.045.ph, %while.body19.preheader ]
> %dec = add nsw i32 %len.247, -1
> %incdec.ptr20 = getelementptr inbounds i8* %src.046, i32 1
> %20 = load i8* %src.046, align 1, !tbaa !8
> %incdec.ptr21 = getelementptr inbounds i8* %dst.045, i32 1
> store i8 %20, i8* %dst.045, align 1, !tbaa !8
> %tobool18 = icmp eq i32 %dec, 0
> br i1 %tobool18, label %while.end22.loopexit, label %while.body19
>
> while.end22.loopexit: ; preds = %while.body19
> br label %while.end22
>
> while.end22: ; preds >
%while.end22.loopexit, %while.cond17.preheader
> ret void
> }
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev