These driver options perform some checking and delegate to MC options -x86-align-branch* and -x86-branches-within-32B-boundaries.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Unit tests: pass. 61683 tests passed, 0 failed and 779 were skipped.
clang-tidy: fail. Please fix clang-tidy findings.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
In D72227 you wrote
I think options should follow these principles:
- Different options are position independent. -mA -mB should be the same as -mB -mA.
- -mA and -mno-A are position dependent and the last one wins. Sometimes, the set may include more than 2 options, e.g. the last of -fno-pic -fpie and -fpic wins.
- More specific options can override semantics of less specific options. In our case, -malign-branch* are more specific than -malign-branch-within-32B-boundaries.
This implemetation is consistent with the principles. However, as I mentioned in D72227, I hold a slightly different opinion about the principles.
- Different options are position independent. -mA -mB should be the same as -mB -mA.
I think only when A and B are not related, (-mA -mB) == (-mB -mA).
- -mA and -mno-A are position dependent and the last one wins. Sometimes, the set may include more than 2 options, e.g. the last of -fno-pic -fpie and -fpic wins
Totally agree.
- More specific options can override semantics of less specific options. In our case, -malign-branch* are more specific than -malign-branch-within-32B-boundaries.
I think general options can aslo override specific options. The last one wins. e.g.
The net effect of -malign-branch=fused -malign-branch-within-32B-boundaries should be -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp -malign-branch-prefix-size=5
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
2034 | AlignBranch = StringRef() seems unnecessary. | |
2040 | Any reason for precluding 16? | |
2053 | AlignBranch = StringRef() seems unnecessary. |
Unit tests: pass. 61743 tests passed, 0 failed and 780 were skipped.
clang-tidy: fail. Please fix clang-tidy findings.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Unit tests: fail. 61741 tests passed, 2 failed and 780 were skipped.
failed: Clang.Driver/x86-malign-branch.c failed: Clang.Driver/x86-malign-branch.s
clang-tidy: fail. Please fix clang-tidy findings.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
The commutative property (independence of options) makes option composition easier. clangDriver makes heavy use of getLastArg and hasArg. Without the commutative property, it would now be able to shuffle code around.
The -malign-branch=jmp -mno-branches-within-32B-boundaries issue does not matter that much. I do not expect -mno-branches-within-32B-boundaries to be used much. If we want to disable branch alignment, -malign-branch-boundary=0 can be used.
-x86-align-branch-prefix-size= does not work without D72225, but I think the two patches can be independent. GCC does not support these options and no projects rely on the option yet.
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
2040 | I am sorry that I misunderstood the word "preclude". As far as I know, we would like AlignBranchBoundary>=32 |
The behaviour of your proposal is "specific option is always override the gerneral option, no matter which is the last". I still prefer not to support the override, which makes things more clear. But I am fine if other reviewers believe this behaviour is reasonable. @jyknight @reames @craig.topper
clang/include/clang/Basic/DiagnosticDriverKinds.td | ||
---|---|---|
254 | The error information "must be one of: " is kind of misleading. |
clang/include/clang/Basic/DiagnosticDriverKinds.td | ||
---|---|---|
254 | The error information "must be one of: " is kind of misleading. |
Delete -mno-branches-within-32B-boundaries (GNU as does not support it)
Use comma joined list instead of +. CommaJoined is more conventional. For example, -mrecip= and -fsanitize= a comma separated list.
Unit tests: pass. 61771 tests passed, 0 failed and 780 were skipped.
clang-tidy: fail. Please fix clang-tidy findings.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Unit tests: fail. 61862 tests passed, 1 failed and 781 were skipped.
failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_sharedtimedmutex_requirements/thread_sharedtimedmutex_class/try_lock.pass.cpp
clang-tidy: unknown.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
It is included in the release branch.
git branch origin/release/10.x --contains 5ca24d09aefaedf8e4148c7fce4b4ab0c4ecc72a # suceeded
The error information "must be one of: " is kind of misleading.
It seems that one kind of branch can be aligned.