Skip to content

Commit 8503079

Browse files
authored
[SYCL] Revert prepare-builtins change for non-NativeCPU. (#18490)
In #17999 I changed prepare-builtins to clear target-cpu and target-features for NativeCPU, and attempted to preserve existing behavior for other targets. For NativeCPU, two errors cancelled each other out so we do the right thing there, but for other targets, that is not the case and target-cpu and target-features were also being cleared unintentionally.
1 parent 637476e commit 8503079

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libclc/utils/prepare-builtins.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ int main(int argc, char **argv) {
143143
//
144144
// NativeCPU uses the same builtins for multiple host targets and should
145145
// likewise not have features that limit the builtins to any particular
146-
// target.
146+
// target. It does not record any target triple so as to not confuse opt.
147+
// TODO If this gets upstreamed into LLVM, it should be recognized in
148+
// llvm::Triple.
147149
if (M->getTargetTriple().str().find("amdgcn") != std::string::npos ||
148-
M->getTargetTriple().str() != "native_cpu") {
150+
M->getTargetTriple().str() == "") {
149151
AttributeMask AM;
150152
AM.addAttribute("target-features");
151153
AM.addAttribute("target-cpu");

0 commit comments

Comments
 (0)