Page MenuHomePhabricator

[preprocessor] Add an opportunity to retain excluded conditional blocks
ClosedPublic

Authored by emankov on Aug 22 2019, 8:35 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

emankov created this revision.Aug 22 2019, 8:35 AM
vpykhtin accepted this revision.Fri, Aug 23, 8:12 AM

I'm not an expert in this part of the compiler, but looks good.

This revision is now accepted and ready to land.Fri, Aug 23, 8:12 AM

I don't have a good idea of the intent of this patch. It seems to me that this could do some pretty nasty damage to C code, right?

Can you give better examples/tests of where this is important or useful?

I don't have a good idea of the intent of this patch. It seems to me that this could do some pretty nasty damage to C code, right?

Right, it could as well as SingleFileParseMode flag.

Can you give better examples/tests of where this is important or useful?

Sure, as I mentioned in the description, source to source transformation; in my case CUDA -> HIP transformation.

CUDA:

#ifdef SOME_MACRO
  axpy_kernel <<<1, 3>>> (a, y, x);
#else
  axpy_kernel <<<1, 4>>> (a, x, y);
#endif

HIP:

#ifdef SOME_MACRO
  hipLaunchKernelGGL(axpy_kernel, dim3(1), dim3(3), 0, 0, a, y, x);
#else
  hipLaunchKernelGGL(axpy_kernel, dim3(1), dim3(4), 0, 0, a, x, y);
#endif
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptTue, Aug 27, 3:15 PM