[LLVMdev] Removing TargetMachine CPU auto-detection for PowerPC and SystemZ?

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Mon Mar 23 10:21:17 PDT 2015

Hi Hal,

I only just noticed that about a year ago, Jim removed CPU auto-detection
for the X86 target:

>Currently the X86 backend does CPU auto-detection and subtarget feature
>detection when the TargetMachine is created if no explicit CPU was
>specified. It's counterintuitive for low level tools like ‘llc’ to do
>this, as it means the same .ll file compiled on heterogenous machines
>generates different results from the same ‘llc’ command line. It is still
>useful to be able to opt-in to such behavior to, for example, replicate
>clang’s behavior when -mcpu=native is supplied to clang. My thought is
>to do something similar here and teach ‘llc’ to recognize -mcpu=native
>and probe the host CPU if that is given. The subtarget features will
>then be filled in according to the feature string for that CPU. This
>(a) changes the auto-detection from opt-out to opt-in and (b) moves
>the logic out of the core target backend and into the tools drivers.

>Attached are draft patches that do this for X86. Similar but smaller
>cleanups can also be done for SystemZ and PowerPC if it’s agreed this
>is a good idea.

However, this was then never implemented for SystemZ and PowerPC.  Should
we do so as well?

Note that mesa has in the meantime changed to do the auto-detection before
setting up the JIT context, and I assume other JIT users have done so as
well by now.  For clang, this was never done automatically anyway.

Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU/Linux compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294

More information about the llvm-dev mailing list