This is an archive of the discontinued LLVM Phabricator instance.

[X86] Relocate code of replacement of subtarget unsupported masked memory intrinsics to run also on -O0 option
ClosedPublic

Authored by aymanmus on Apr 25 2017, 7:19 AM.

Details

Summary

Currently, when masked load, store, gather or scatter intrinsics are used, we check in CodeGenPrepare pass if the subtarget support these intrinsics, if not we replace them with scalar code - this is a functional transformation not an optimization (not optional).

CodeGenPrepare pass does not run when the optimization level is set to CodeGenOpt::None (-O0).

Functional transformation should run with all optimization levels, so here I created a new pass which runs on all optimization levels and does no more than this transformation.

Diff Detail

Event Timeline

aymanmus created this revision.Apr 25 2017, 7:19 AM
zvi added inline comments.Apr 26 2017, 1:18 PM
lib/CodeGen/TargetPassConfig.cpp
494

Do we want this pass added for all targets unconditionally?

aymanmus added inline comments.Apr 27 2017, 12:08 AM
lib/CodeGen/TargetPassConfig.cpp
494

Yes, all targets (except for X86) define these intrinsics as illegal by inheriting the target hooks isLegalMasked{Load/Store/Gather/Scatter} (From TargetTransformInfo) which are set to return false by default.

The pass' transformations are completely controlled by target hooks so it's safe to run it on all targets (it's even a functional demand).

zvi added inline comments.May 9 2017, 8:14 AM
test/CodeGen/X86/replace_unsupported_masked_mem_intrin.ll
3

Can you please open a bug report with a description of the issue that causes this test to crash, and a the pr# as reference in this test?

aymanmus updated this revision to Diff 98596.May 11 2017, 1:36 AM
aymanmus marked an inline comment as done.
delena accepted this revision.May 15 2017, 3:52 AM
This revision is now accepted and ready to land.May 15 2017, 3:52 AM
This revision was automatically updated to reflect the committed changes.