When legalizing G_LOAD/G_STORE using NarrowScalar, we should avoid emitting
%0 = G_CONSTANT ty 0
%1 = G_GEP %x, %0
since it's cheaper to not emit the redundant instructions than it is to fold them
away later.
Details
Diff Detail
- Build Status
Buildable 6054 Build 6054: arc lint + arc unit
Event Timeline
LGTM modulo a small refactoring to avoid code duplication.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
288 | Could you factorize the code in a helper function? |
Factored out the optimization into MachineIRBuilder.
@qcolombet: Before I commit, I'd just like to double-check that the new
materializeGEP() function in MachineIRBuilder is ok with you. The
materialize*() name is intended to be used for instructions that may have to
create vregs in some cases.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
249 | could you calculate offset type base on pointer size ? So it will be legal for 32bit targets . |
Is this clang-formated?
In the browser it looks larger than 80-col, but it may just be an impression.