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)
commit563a9cf7ba3055921b7de9f05dd9223e82d20aba
treee6bf3be21c5ebeb8ee007129b2da3ab3fb3975ea
parentc572005d7be00b824a105a313532529c678bd0d3
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187119 91177308-0d34-0410-b5e6-96231b3b80d8
test/TableGen/intrinsic-order.td [new file with mode: 0644]
utils/TableGen/IntrinsicEmitter.cpp