This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix constness of pointer params to load intrinsics
ClosedPublic

Authored by tlively on May 4 2021, 10:22 PM.

Details

Summary

Update the SIMD builtin load functions to take pointers to const data and update
the intrinsics themselves to not cast away constness.

Diff Detail

Event Timeline

tlively created this revision.May 4 2021, 10:22 PM
tlively requested review of this revision.May 4 2021, 10:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2021, 10:22 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Why do only these instructions have const? It doesn't apply to other read-only arguments?

It only matters for pointer parameters. For example, const int * is meaningfully different from int *, but const int is not usefully different from int.

aheejin accepted this revision.May 5 2021, 12:48 PM

I see, thanks. Then other load instructions are OK not to be fixed?

  • v128.load
  • v128.loadN_splat
  • v128.loadNxM_s/u
This revision is now accepted and ready to land.May 5 2021, 12:48 PM

I see, thanks. Then other load instructions are OK not to be fixed?

  • v128.load
  • v128.loadN_splat
  • v128.loadNxM_s/u

Yep, the intrinsics for those instructions were already using const pointers correctly.

This revision was landed with ongoing or failed builds.May 5 2021, 1:17 PM
This revision was automatically updated to reflect the committed changes.