This is an archive of the discontinued LLVM Phabricator instance.

[C++, test] Fix typo in NSS* vars
ClosedPublic

Authored by thopre on Apr 3 2021, 6:59 AM.

Details

Summary

The NSS FileCheck variables at the end of the
CodeGenCXX/split-stacks.cpp clang testcase are off by 1, resulting in
the use of an undefined variable (NSS3). One of the CHECK-NOT is also
redundant because _Z8tnosplitIiEiv uses the same attribute as _Z3foov
without split stack. This commit fixes that.

Diff Detail

Event Timeline

thopre requested review of this revision.Apr 3 2021, 6:59 AM
thopre created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2021, 6:59 AM
ChuanqiXu added inline comments.Apr 19 2021, 7:25 PM
clang/test/CodeGenCXX/split-stacks.cpp
30–31

I find NSS2 equals to NSS0, which is #0. It looks good to me if this could handle the inconsistency.

thopre added inline comments.Apr 20 2021, 1:37 AM
clang/test/CodeGenCXX/split-stacks.cpp
30–31

Only without split stack (second RUN line). With split stack I get:

; Function Attrs: noinline nounwind optnone uwtable mustprogress
define dso_local i32 @_Z3foov() #0 {
entry:
  ret i32 0
}

; Function Attrs: noinline optnone uwtable mustprogress
define dso_local i32 @_Z7nosplitv() #1 {
entry:
  %call = call i32 @_Z8tnosplitIiEiv()
  ret i32 %call
}

; Function Attrs: noinline nounwind optnone uwtable mustprogress
define linkonce_odr dso_local i32 @_Z8tnosplitIiEiv() #2 comdat {
entry:
  ret i32 0
}
ChuanqiXu added inline comments.Apr 20 2021, 2:49 AM
clang/test/CodeGenCXX/split-stacks.cpp
30–31

Yeah, this is what I get without split stack:

; Function Attrs: noinline nounwind optnone uwtable mustprogress
define dso_local i32 @_Z3foov() #0 {
entry:
  ret i32 0
}

; Function Attrs: noinline optnone uwtable mustprogress
define dso_local i32 @_Z7nosplitv() #1 {
entry:
  %call = call i32 @_Z8tnosplitIiEiv()
  ret i32 %call
}

; Function Attrs: noinline nounwind optnone uwtable mustprogress
define linkonce_odr dso_local i32 @_Z8tnosplitIiEiv() #0 comdat {
entry:
  ret i32 0
}

attributes #0 = { noinline nounwind optnone uwtable mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noinline optnone uwtable mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

My compiler version is latest trunk:2ea6ed9b70c6495342e39a7d1.

thopre added inline comments.Apr 20 2021, 3:03 AM
clang/test/CodeGenCXX/split-stacks.cpp
30–31

We get the same thing. The code I pasted about was *with* split stack. Since it's the same FileCheck directive with and without split stack it makes sense to keep NSS0 and NSS2 separate otherwise the split-stack case would fail.

ChuanqiXu added inline comments.Apr 20 2021, 3:42 AM
clang/test/CodeGenCXX/split-stacks.cpp
30–31

The FileCheck directive seems different with and without split stack. And the number of attributes is different from what we paste.

thopre updated this revision to Diff 338811.Apr 20 2021, 4:00 AM
thopre marked an inline comment as done.

Remove NSS2 variable since _Z8tnosplitIiEiv uses the same attribute as _Z3foov

thopre marked 2 inline comments as done.Apr 20 2021, 4:00 AM
thopre added inline comments.
clang/test/CodeGenCXX/split-stacks.cpp
30–31

Ah my bad, you are absolutely right. Difference in attributes is not a problem since these are CHECK-NOT directives but I've changed it nonetheless.

This revision is now accepted and ready to land.Apr 20 2021, 4:02 AM
thopre edited the summary of this revision. (Show Details)Apr 20 2021, 4:06 AM
This revision was landed with ongoing or failed builds.Apr 20 2021, 4:07 AM
This revision was automatically updated to reflect the committed changes.