This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Remove redundant else for PER_TARGET_RUNTIME_DIR
AbandonedPublic

Authored by DavidSpickett on Nov 28 2022, 6:21 AM.

Details

Summary

The else is slightly different but I confirmed that only the first
if is run, so presumably that is the correct one.

Diff Detail

Event Timeline

DavidSpickett created this revision.Nov 28 2022, 6:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 6:21 AM
Herald added subscribers: Enna1, dberris. · View Herald Transcript
DavidSpickett requested review of this revision.Nov 28 2022, 6:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 6:21 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
DavidSpickett added a subscriber: Ericson2314.

This was added in https://reviews.llvm.org/D105765 by @Ericson2314.

The else adds ${COMPILER_RT_OS_DIR} as well, not sure if this was left in by mistake.

This was added in https://reviews.llvm.org/D105765 by @Ericson2314.

The else adds ${COMPILER_RT_OS_DIR} as well, not sure if this was left in by mistake.

This works in tandem with https://github.com/llvm/llvm-project/blob/2f8ac1804827026b44f429dce02730da18a73c50/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L442-L458 so I expect the else to be needed. Have you tested this on Darwin? What's the motivation for this cleanup? Have you noticed any issue caused by D105765?

I think we can combine the two branches and rely solely on https://github.com/llvm/llvm-project/blob/2f8ac1804827026b44f429dce02730da18a73c50/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L442-L458 for constructing the final path, but it's going to need some additional cleanup (these paths are also used for code signing on Darwin).

DavidSpickett abandoned this revision.Nov 29 2022, 3:06 AM

This is actually me misunderstanding cmake syntax. else(<condition>) doesn't actually check the condition, it's just noting that it's the else for an if that had that condition. If it were an elseif, then it would be checking the condition.

So the else is not dead code after all.