Llvm-diff flags same IRs as different

Hi all, for the following test.ll

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #0

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare double @llvm.cos.f64(double) #1

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare double @llvm.sin.f64(double) #1

define void @foo() {
entry:
  br label %for.cond

for.cond:                                         ; preds = %for.inc, %entry
  %d.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
  br label %for.inc

for.inc:                                          ; preds = %for.cond
  %inc = add i32 0, 0
  br label %for.cond
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare double @llvm.pow.f64(double, double) #1

define void @bar() {
for.body5:
  br i1 false, label %if.then, label %lor.lhs.false

lor.lhs.false:                                    ; preds = %for.body5
  br label %if.then

if.then:                                          ; preds = %lor.lhs.false, %for.body5
  %0 = call fast double @llvm.sqrt.f64(double 0.000000e+00)
  ret void
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare double @llvm.sqrt.f64(double) #1

attributes #0 = { argmemonly nofree nosync nounwind willreturn }
attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
$ llvm-diff test.ll test.ll
in function foo:
  in block %for.cond:
    >   %d.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
    <   %d.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]

Even though both the inputs are same IR, llvm-diff is reporting the exact same line as different. How to avoid this? Is this a bug?
I am using llvm-diff to check if a transform has changed the IR or not. Is there a better way to check for this?

How to avoid this? Is this a bug?

Without knowing too much about llvm-diff, this sounds like a bug to me. Patches welcome :slight_smile: