[flang-commits] [flang] [flang] Check x86 CPU and issue diagnostics (PR #127950)

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Thu Feb 20 08:32:02 PST 2025


banach-space wrote:

Thanks for the fix!

> > > How does `clang` check for this? Can we share some code between `clang` and `flang`?
> > 
> > 
> > See this comment: [#97466 (comment)](https://github.com/llvm/llvm-project/issues/97466#issuecomment-2211752286)
> > To share the code would be more work than I currently have time to do. My goal was to try to fix immediate flang crash issue for x86. (ARM doesn't crash for invalid CPU, but it does something different.) Perhaps we can fix x86 now and file a new "feature" issue for trying to get some code re-use in flang and clang?
> 
> Unless @banach-space has any objections, I am ok with it. Could you add a comment to the code explaining that this could be done better and that it is a short-term fix. You could refer to the issues and comments. Filing a feature issue will also help track it.

If you are OK with this then so am I :)

I suggest being explicit about the limitations/assumptions made. Specifically, `checkSupportedCPU` suggests that this is a generic hook that's meant to be used by all targets. However, this is clearly an X86-specific fix. Lets rename the hook accordingly and add TODOs.

Also, back when this was reported I put some cycles into providing possible "generic" solutions:
* https://github.com/llvm/llvm-project/issues/97466#issuecomment-2211752286

I don't see any justification not to follow that other than:
> To share the code would be more work than I currently have time to do. 

Still, could you include this somewhere? It should be "easy" to identify why wasn't the "generic" route followed.

>  Perhaps we can fix x86 now and file a new "feature" issue for trying to get some code re-use in flang and clang?

Please create a ticket.

-Andrzej

https://github.com/llvm/llvm-project/pull/127950


More information about the flang-commits mailing list