[PATCH] [CodeGen][NEON] Emit constants, not ScalarExprs, for "immediate" intrinsic arguments.

Ahmed Bougacha ahmed.bougacha at gmail.com
Tue May 26 16:47:40 PDT 2015


Hi jmolloy, rsmith,

On ARM/AArch64, we currently always use EmitScalarExpr for the immediate builtin arguments, instead of directly emitting the constant.  When the overflow sanitizer is enabled, this generates overflow intrinsics instead of constants, breaking assumptions in various places (see [[ https://llvm.org/bugs/show_bug.cgi?id=23517 | PR23517 ]]).

Instead, use the knowledge of "immediates" to directly emit the constant.

I don't think there's much room for factoring out the operand emission code; if folks feel strongly I can give it another shot!

Note that the NeonEmitter changes can be simplified to the somewhat hacky:

    if (hasImmediate() && getImmediateIdx() == I) {
      S += "I";
      T.makeInteger(32, true);
    }

in getBuiltinTypeStr.  James, which do you prefer?

http://reviews.llvm.org/D10045

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/neon-immediate-ubsan.c
  utils/TableGen/NeonEmitter.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10045.26552.patch
Type: text/x-patch
Size: 6984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150526/00407e55/attachment.bin>


More information about the cfe-commits mailing list