[LLVMbugs] [Bug 1053] NEW: Processor autodetection incorrect
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sat Dec 16 09:57:57 PST 2006
http://llvm.org/bugs/show_bug.cgi?id=1053
Summary: Processor autodetection incorrect
Product: tools
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P2
Component: TableGen
AssignedTo: unassignedbugs at nondot.org
ReportedBy: scottm at aero.org
This bug initially manifests itself while building the c frontend, but it isn't
really a cfe bug (sorta). The CFE sets the rs6000_cpu variable to
PROCESSOR_DEFAULT, which turns out to be PROCESSOR_POWER4.
llvm::PPCSubtarget::ParseSubtargetFeatures eventually gets a string that
represents the default processor architecture, which starts with "-970",
corresponding to PROCESSOR_POWER4.
This effectively nails the processor architecture down to always being a G5/970.
tblgen emits code that will only set the specific CPU iff the CPU isn't set yet
(call setCPUIfNone())
Meanwhile, llvm has correctly identified the host CPU, which is a G4 in my case.
Because setCPUIfNone() is called and the default features string specified a
970, the processor is de-facto set to a G5 irrespective of the actual, detected
processor.
This patch is an attempt to fix/remedy the bug (but it might not be entirely
correct):
Index: utils/TableGen/SubtargetEmitter.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/utils/TableGen/SubtargetEmitter.cpp,v
retrieving revision 1.24
diff -u -r1.24 SubtargetEmitter.cpp
--- utils/TableGen/SubtargetEmitter.cpp 12 Dec 2006 20:55:58 -0000 1.24
+++ utils/TableGen/SubtargetEmitter.cpp 16 Dec 2006 17:50:10 -0000
@@ -461,7 +461,8 @@
OS << "Subtarget::ParseSubtargetFeatures(const std::string &FS,\n"
" const std::string &CPU) {\n"
" SubtargetFeatures Features(FS);\n"
- " Features.setCPUIfNone(CPU);\n"
+ " if (CPU != \"\");\n"
+ " Features.setCPU(CPU);\n"
" uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n"
" FeatureKV, FeatureKVSize);\n";
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list