[PATCH] D80691: Proposed fix for PR46114

Qirun Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 17:54:02 PDT 2020


helloqirun added a comment.

Thanks @Orlando, I think I agree with your reasoning. My patch on introducing an undef is based on the same reasoning (but I could be totally wrong).

Let's see what we should do instead.

Before earlycse, we have:

    %0 = load i32, i32* @a, align 4, !dbg !26, !tbaa !27
    call void @llvm.dbg.value(metadata i32 0, metadata !22, metadata !DIExpression()), !dbg !31
    %1 = load i32, i32* @a, align 4, !dbg !32, !tbaa !27
    call void @llvm.dbg.value(metadata i32 %1, metadata !22, metadata !DIExpression()), !dbg !31
  
  !26 = !DILocation(line: 5, column: 11, scope: !17)
  !31 = !DILocation(line: 0, scope: !17)
  !32 = !DILocation(line: 6, column: 15, scope: !17)

after earlycse, we have:

    %0 = load i32, i32* @a, align 4, !dbg !26, !tbaa !27
  ; I omitted the variable !21 here since it's irrelevant.
    call void @llvm.dbg.value(metadata i32 0, metadata !22, metadata !DIExpression()), !dbg !31
    call void @llvm.dbg.value(metadata i32 %0, metadata !22, metadata !DIExpression()), !dbg !31
  
  !21 = !DILocalVariable(name: "d", scope: !17, file: !3, line: 5, type: !12)
  !22 = !DILocalVariable(name: "l_52", scope: !17, file: !3, line: 5, type: !12)
  !26 = !DILocation(line: 5, column: 11, scope: !17)
  !31 = !DILocation(line: 0, scope: !17)
  !32 = !DILocation(line: 6, column: 20, scope: !17)

Could you please help me verify the following?
Based on my understanding, it seems that when eliminating the second  `load i32, i32* @a` in EarlyCSE, we should use the location `!32` instead of `!26` for the resulting `load i32, i32* @a`.
Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80691/new/

https://reviews.llvm.org/D80691





More information about the llvm-commits mailing list