[PATCH] D44093: [BUILTINS] structure pretty printer

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 10 15:01:10 PDT 2018


aaron.ballman added a comment.

In https://reviews.llvm.org/D44093#1063658, @paulsemel wrote:

> Sorry about it, I also have the warning on my machine, but not the error you get...
>  Those test are actually working on my different linux machines, that's really weird.
>  This one is actually really weird, because I could find manually the missing pattern in your output.. I just don't get what is happening.


I think the issue has to do with bit-width. From unit5():

  // Your test
  
    // CHECK: call i32 (i8*, ...) @printf(
    // CHECK: [[RES1:%[0-9]+]] = getelementptr inbounds %struct.U5A, %struct.U5A* %a, i32 0, i32 0
    // CHECK: call i32 (i8*, ...) @printf(
    // CHECK: [[LOAD1:%[0-9]+]] = load i64, i64* [[RES1]],
    // CHECK: call i32 (i8*, ...) @printf({{.*}}, i64 [[LOAD1]])
    // CHECK: call i32 (i8*, ...) @printf(
  
  // My results
  
  ; Function Attrs: noinline nounwind optnone
  define dso_local void @unit5() #0 {
  entry:
  
    %a = alloca %struct.U5A, align 4
    %0 = bitcast %struct.U5A* %a to i8*
    call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %0, i8* align 4 bitcast (%struct.U5A* @unit5.a to i8*), i64 4, i1 false)
    %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @16, i32 0, i32 0))
    %2 = getelementptr inbounds %struct.U5A, %struct.U5A* %a, i32 0, i32 0
    %3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @17, i32 0, i32 0))
    %4 = add i32 %1, %3
    %5 = load i32, i32* %2, align 4
    %6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @18, i32 0, i32 0), i32 %5)
    %7 = add i32 %4, %6
    %8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @19, i32 0, i32 0))
    %9 = add i32 %7, %8
    ret void
  }

You are testing that the load is an i64 but in my results it's an i32. An explicit target triple on the RUN line solves the issue.


Repository:
  rC Clang

https://reviews.llvm.org/D44093





More information about the cfe-commits mailing list