This is an archive of the discontinued LLVM Phabricator instance.

Introduce and use codegen::createTargetMachineForTriple()
ClosedPublic

Authored by arichardson on Jan 5 2023, 7:24 AM.

Details

Summary

This creates a TargetMachine with the default options (from the command
line flags). This allows us to share a bit more code between tools.

Diff Detail

Event Timeline

arichardson created this revision.Jan 5 2023, 7:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2023, 7:24 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
arichardson published this revision for review.Jan 6 2023, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 5:12 AM
nikic added inline comments.Jan 6 2023, 5:27 AM
llvm/include/llvm/CodeGen/CommandFlags.h
194

nit: Drop last part of the comment (which is not part of this patch).

llvm/lib/CodeGen/CommandFlags.cpp
741

Some of the uses called Triple::normalize(), but this doesn't. Is that a problem?

arichardson marked 2 inline comments as done.

Address review comments

arichardson added inline comments.Oct 4 2023, 10:56 AM
llvm/lib/CodeGen/CommandFlags.cpp
741

I don't think it will but I've added back the calls.

llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
142

Oh missed the normalize here.

Fix a missing normalize call

nikic accepted this revision.Oct 4 2023, 12:28 PM

LGTM

This revision is now accepted and ready to land.Oct 4 2023, 12:28 PM

This breaks the builds.

/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/bin/opt: error: unable to get target for 'nvptx64-nvidia-cuda', see --version and --triple.

This breaks the builds.

/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/bin/opt: error: unable to get target for 'nvptx64-nvidia-cuda', see --version and --triple.

I believe I fixed that with https://github.com/llvm/llvm-project/commit/eb1905d2b6928be4b0258f021d145432ab7d292e