For each array index of GEP in the form of zext(a), convert it to sext(a)
if we can prove zext(a) <= max signed value of typeof(a). The conversion
helps to split zext(x + y) into sext(x) + sext(y).
Depends on D4056
Paths
| Differential D4060
[SeparateConstOffsetFromGEP] inbounds zext => sext for better splitting ClosedPublic Authored by jingyue on Jun 7 2014, 9:44 PM.
Details
Diff Detail Event Timelinemeheff edited edge metadata. Comment ActionsLGTM after clarifying and fixing some of the comments.
This revision is now accepted and ready to land.Jun 8 2014, 11:39 AM
Revision Contents
Diff 10220 lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep-and-gvn.ll
test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll
|
spelling: Verified. Also it would be good to include in this comment why it is advantageous to convert zexts in to sexts. It's not immediately clear because like zext for some values of a and b: sext(a + b) != sext(a) + sext(b). Include the how sext and add with positive result is handled as a special case while no such case exists for zext.