[Hexagon] Account for negative offset when limiting max deviation
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 25 Oct 2017 18:46:40 +0000 (18:46 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 25 Oct 2017 18:46:40 +0000 (18:46 +0000)
commit27056da9a872d956707af671981c7a75696b2bd6
tree55f314dfb45a2fe46d78e3f1618a612f4e713fa1
parentcfa171d68c8e22f0c789639a6760e578ba774759
[Hexagon] Account for negative offset when limiting max deviation

In getOffsetRange, Max can be set to 0 to force the extender replacement
to be at or below the original value. This would cause the new offset to
be non-negative, which is preferred for memory instructions (to reduce
the likelihood of it getting constant-extended due to predication). The
problem happens when the range is shifted by an offset (present in the
instruction being examined) and the offset is negative. The entire range
for the allowable deviation will then be strictly negative. This creates
a problem, since 0 is assumed to be a valid deviation.

llvm-svn: 316601
llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp
llvm/test/CodeGen/Hexagon/cext-opt-range-offset.mir [new file with mode: 0644]