This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by ab on May 26 2015, 4:47 PM.

Details

Summary

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 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?

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 26552.May 26 2015, 4:47 PM
ab retitled this revision from to [CodeGen][NEON] Emit constants, not ScalarExprs, for "immediate" intrinsic arguments..
ab updated this object.
ab edited the test plan for this revision. (Show Details)
ab added reviewers: jmolloy, rsmith.
ab added a subscriber: Unknown Object (MLST).
t.p.northover accepted this revision.Jun 1 2015, 11:18 AM
t.p.northover added a reviewer: t.p.northover.
t.p.northover added a subscriber: t.p.northover.

Hi Ahmed,

This looks reasonable to me, and I see Richard suggested the overall approach.

Tim.

This revision is now accepted and ready to land.Jun 1 2015, 11:18 AM
This revision was automatically updated to reflect the committed changes.