This is an archive of the discontinued LLVM Phabricator instance.

[Thumb-1] Fix corner cases for compressed jump tables
ClosedPublic

Authored by weimingz on Apr 19 2017, 3:08 PM.

Details

Summary

When synthesized TBB/TBH is expanded, we need to avoid the case of:

BaseReg is redefined after the load of branching target. E.g.:
%R2 = tLEApcrelJT <jt#1>
%R1 =  tLDRr %R1, %R2
%R2 = tLDRspi %SP, 12
tBR_JTr %R1
After JT compression, it becomes
%R2 = tLEApcrelJT <jt#1>
%R2 = tLDRspi %SP, 12
tTBB_JT %R2, %R1

Diff Detail

Repository
rL LLVM

Event Timeline

weimingz created this revision.Apr 19 2017, 3:08 PM
weimingz edited the summary of this revision. (Show Details)Apr 19 2017, 3:17 PM

This fixes some SPEC2000 fails when build for Thumb1 with -Os.
I do not upload the lit test because it's not easy to reduce to a simple/clean one as it needs specific reg alloc to show the problem.

jmolloy accepted this revision.Apr 20 2017, 12:52 AM

LGTM, thanks for catching these!

This revision is now accepted and ready to land.Apr 20 2017, 12:52 AM
weimingz updated this revision to Diff 95996.Apr 20 2017, 11:44 AM

Just find that one case was fixed by r297871 ARM: avoid clobbering register in v6 jump-table expansion.

weimingz edited the summary of this revision. (Show Details)Apr 20 2017, 11:45 AM
This revision was automatically updated to reflect the committed changes.