Compiling with Intel c++ 8.0


I am attempting to compile the llvm distribution with the Intel Compiler 8.0
on linux and I have some minor patches I would like to apply. In our project
we compile and run the code both on win32, together with Morten Ofstad using
the MS compiler, and on linux using the intel compiler.

I have wrapped the extra code to make llvm compile for icc in

The patches in llvm/autoconf is to assure the configure scripts allows the
compiler icc to be run during the macro "checking tools compability".

PS: It would be nice if from the configure options one could choose more
strictly amongst whats going to be compiled and not. E.g., I would like to
say I would only compile the libs (no tools or utillities), neither do I
need the compression support like bzlib.

PPS: The Makefile.rules file clearly defined gcc compile time flags, if I
create a "--enable-intel-compiler" option and perform a global naming in
such a way that one could differentiate between the GNU compiler and the ICC
compiler - and hence setup the compile-time flags - would that be the way to


Bjørn Wennberg | | +47 98678266 |

intel.diff (14.1 KB)

Great! I'm going to leave the configury stuff to Reid, but here's some feedback on the rest of the patches. I've committed a bunch of them:

However, could you explain why there hunks are needed? For changes like this, it is usually good to separate the "obvious" changes from the others into distinct patches. Here are the ones that would be good to have comments added to them explaining them:

DataStructure/DSGraph.h: why is the method moved out of line? Please add a comment before the out-of-line body indicating why it should not be moved back inline.

Analysis/AliasAnalysis.cpp: why don't you need the external stub? Does it work for you like this?

namespace llvm {
   extern void BasicAAStub();

include/llvm/ADT/HashExtras.h: Is pointer support already built into the intel headers, making the hash implementation unneeded? If so, please add a comment to the #ifndef indicating that.

As a general comment, please keep source lines within 80 columns. Otherwise the patches look great, thanks a lot!



I did some more testing on this topic:
ICC complained that the last template was partially loaded and would be used
to instantiate the template<> struct hash<const char *>.
Rearranging the templates so that one for arbritraty pointers (inlined)
comes first, works excellent for icc.

template <class T> struct hash<T *> {
  inline size_t operator()(const T *Val) const {
    return reinterpret_cast<size_t>(Val);

template <> struct hash<std::string> {
  size_t operator()(std::string const &str) const {
    return hash<char const *>()(str.c_str());

The inline function uses std::find() which is defined in <algorithm>.
<algorithm> is only included in the implementation file of
The choise was either to include <algorithm> in the headerfile (increasing
potentially overall compilation time), or defining the function in the .cpp
file. I chose the latter to be conformant with what you do.

ICC gives me an error saying the function is already declared as extern.
However, as you suggest:
namespace llvm {
  extern void BasicAAStub();
Works like a charm ! Thanx. (Should have thought of that....)


... notes on patches


Sounds good, all 3 are applied now, thanks!


The and configure script changes have also been applied.

Thanks, Bjrn.