[PATCH] D29542: [TargetInfo] Adjust x86-32 atomic support to the CPU used

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 5 14:07:59 PST 2017


jlebar added inline comments.


================
Comment at: lib/Basic/Targets.cpp:1784
+      // atomics. This matches the defaults for the systems using CUDA.
+      // TODO: pass the host target CPU
+      if (HostTriple.getArch() == llvm::Triple::x86)
----------------
Someone else is calling setCPU on the HostTarget.  If they're calling it after we call it here, this is obviously not going to work.  Since it does work, I presume they are calling it before we get here.  In which case, can we not just set `MaxAtomicPromoteWidth=HostTarget->MaxAtomicPromoteWidth` right after we set `MaxAtomicInlineWidth = HostTarget->getMaxAtomicInlineWidth();` below?

(Note that as written definitely isn't right because it assumes that HostTarget is non-null.)


https://reviews.llvm.org/D29542





More information about the cfe-commits mailing list