[PATCH] D92061: [MS] Fix double evaluation of MSVC builtin arguments

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 15:53:47 PST 2020


rnk created this revision.
rnk added reviewers: hans, thakis, rsmith, akhuang.
Herald added a subscriber: jfb.
Herald added a project: clang.
rnk requested review of this revision.

This code got quite twisted because we consider some MSVC builtins to be
target agnostic, and some to be target specific. Target specific
intrinsics have a pattern of doing up-front argument evaluation, while
general intrinsics do not evaluate their arguments up front. As we tried
to share codepaths between the target-specific and target-agnostic
handling, we ended up doing double evaluation.

Instead, have each target handle MSVC intrinsics consistently before up
front argument evaluation. This requires passing less data around and is
more consistent with target independent intrinsic handling.

See D50979 <https://reviews.llvm.org/D50979> for past examples of this bug. I noticed this while looking
into adding some more intrinsics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92061

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/ms-intrinsics.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92061.307468.patch
Type: text/x-patch
Size: 35433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201124/f928275e/attachment-0001.bin>


More information about the cfe-commits mailing list