[PATCH] D48832: [ARM] ARMCodeGenPrepare backend pass

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 08:02:35 PDT 2018


SjoerdMeijer added a comment.

Hi Sam, I took your patch, and ran some C/C++ language conformance tests with it. Did not come back entirely clean. Here's a first reproducer that throws this compile error:

  LLVM ERROR: Broken function found, compilation aborted!

Input code:

  unsigned char unsigned_char_data[42];
  short short_data[42];
  short short1;
  int foo(void) {
    short1 = (short)unsigned_char_data[2];
    return short1 == short_data[2];
  }

And its corresponding IR that should show this problem:

  @d_uch = hidden local_unnamed_addr global [16 x i8] zeroinitializer, align 1
  @sh1 = hidden local_unnamed_addr global i16 0, align 2
  @d_sh = hidden local_unnamed_addr global [16 x i16] zeroinitializer, align 2
  
  define hidden arm_aapcs_vfpcc i32 @foo() local_unnamed_addr #0 {
  entry:
    %0 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @d_uch, i32 0, i32 2), align 1, !tbaa !5
    %conv = zext i8 %0 to i16
    store i16 %conv, i16* @sh1, align 2, !tbaa !8
    %conv1 = zext i8 %0 to i32
    %1 = load i16, i16* getelementptr inbounds ([16 x i16], [16 x i16]* @d_sh, i32 0, i32 2), align 2, !tbaa !8
    %conv2 = sext i16 %1 to i32
    %cmp = icmp eq i32 %conv1, %conv2
    %conv3 = zext i1 %cmp to i32
    ret i32 %conv3
  }


https://reviews.llvm.org/D48832





More information about the llvm-commits mailing list