Fix a bug in TableGen where the intrinsic function name recognizer could mis-identify...
authorJustin Holewinski <jholewinski@nvidia.com>
Thu, 25 Jul 2013 12:32:00 +0000 (12:32 +0000)
committerJustin Holewinski <jholewinski@nvidia.com>
Thu, 25 Jul 2013 12:32:00 +0000 (12:32 +0000)
commitb3d630ca21c7c89a3c4515313c16a2398a09481d
treeb43cb9a3143db9e22d32726ca739a8192f6e6b35
parent516d7971b317d54622c8267ceeeb87186cc9153c
Fix a bug in TableGen where the intrinsic function name recognizer could mis-identify names if one was a prefix substring of the other

For two intrinsics 'llvm.nvvm.texsurf.handle' and 'llvm.nvvm.texsurf.handle.internal',
TableGen was emitting matching code like:

  if (Name.startswith("llvm.nvvm.texsurf.handle")) ...
  if (Name.startswith("llvm.nvvm.texsurf.handle.internal")) ...

We can never match "llvm.nvvm.texsurf.handle.internal" here because it will
always be erroneously matched by the first condition.

The fix is to sort the intrinsic names and emit them in reverse order.

llvm-svn: 187119
llvm/test/TableGen/intrinsic-order.td [new file with mode: 0644]
llvm/utils/TableGen/IntrinsicEmitter.cpp