Page MenuHomePhabricator

[Utils] Deal with occasionally deleted functions
Needs ReviewPublic

Authored by jdoerfert on Oct 10 2019, 6:26 PM.

Details

Summary

When functions exist for some but not all run lines we need to be
careful when selecting the prefix. So far, a common prefix was
potentially chosen as there was never a "conflict" that would have
caused otherwise. With this patch we avoid common prefixes if they
are used by run lines that do not emit the function.

Tested as part of D68766 and the follow up that adds the Attributor test
lines to all argument promotion tests.

Event Timeline

jdoerfert created this revision.Oct 10 2019, 6:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2019, 6:26 PM
Herald added a subscriber: bollu. · View Herald Transcript
jdoerfert added a comment.EditedMon, Oct 28, 2:50 PM

The difference is when we run update_test_checks.py on the following code

; RUN: opt -S < %s | FileCheck %s --check-prefixes=ALL,FIRST
; RUN: opt -S -globalopt < %s | FileCheck %s --check-prefixes=ALL,SECOND

define internal void @f() {
  ret void
}

we will see

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s | FileCheck %s --check-prefixes=ALL,FIRST
; RUN: opt -S -globalopt < %s | FileCheck %s --check-prefixes=ALL,SECOND

define internal void @f() {
; FIRST-LABEL: define {{[^@]+}}@f(
; FIRST-NEXT:    ret void
;
  ret void
}

and not

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s | FileCheck %s --check-prefixes=ALL,FIRST
; RUN: opt -S -globalopt < %s | FileCheck %s --check-prefixes=ALL,SECOND

define internal void @f() {
; ALL-LABEL: @f(
; ALL-NEXT:    ret void
;
  ret void
}

ping