This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen][test] Use -fno-discard-value-names for better test support
ClosedPublic

Authored by rupprecht on Jun 20 2019, 2:29 PM.

Details

Summary

Depending on how clang is built, it may discard the IR names and use names like %2 instead of %result.ptr, causing tests that rely on the IR name to fail. Using fno-discard-value-names ensures the actual name is present regardless of the build mode.

Event Timeline

rupprecht created this revision.Jun 20 2019, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2019, 2:29 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Looks good, alternatively I think we can just change %result.ptr into a variable match?

Looks good, alternatively I think we can just change %result.ptr into a variable match?

Why isn't this using FileCheck variable matching in the first place? That's the least fragile solution.

Why isn't this using FileCheck variable matching in the first place? That's the least fragile solution.

No reason, just something I overlooked when I wrote it-

rupprecht updated this revision to Diff 205912.Jun 20 2019, 3:11 PM
  • Use filecheck variable matching instead of an explicit -fno-discard-value-names option

Sounds good, changed to use variable matching instead. This passes w/ either -fno-discard-value-names or -fdiscard-value-names used.

akhuang accepted this revision.Jun 20 2019, 3:17 PM

lgtm

This revision is now accepted and ready to land.Jun 20 2019, 3:17 PM
rnk added a comment.Jun 20 2019, 3:21 PM

Thanks. This is surprisingly the first time I've heard of fdiscard-value-names. Seems useful, since now you can test your IR both ways without having to completely recompile clang.

lebedev.ri accepted this revision.Jun 20 2019, 3:23 PM
This revision was automatically updated to reflect the committed changes.