[PATCH] D83667: [ARM] Fix IT block generation after Thumb2SizeReduce with -Oz
Nicholas Guy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 03:36:11 PDT 2020
NickGuy created this revision.
NickGuy added reviewers: samparker, SjoerdMeijer, dmgreen, olista01.
NickGuy added a project: LLVM.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
Fixes a regression caused by D82439 <https://reviews.llvm.org/D82439>, in which IT blocks were no longer being
generated when -Oz is present. This was due to the CPSR register being marked as
dead, while this case was not accounted for.
Tests: 310
Metric: size..text
| Program | Pre-patch | Post-patch | diff |
| ------------------------------------------- | --------- | ---------- | ----- |
| test-suite.../Prolangs-C++/ocean/ocean.test | 2168 | 2160 | -0.4% |
| test-suite...s/Misc/richards_benchmark.test | 1432 | 1428 | -0.3% |
| test-suite...out-C++/Shootout-C++-hash.test | 1696 | 1692 | -0.2% |
| test-suite...ut-C++/Shootout-C++-hash2.test | 1924 | 1920 | -0.2% |
| test-suite.../Applications/spiff/spiff.test | 12200 | 12176 | -0.2% |
| test-suite.../Benchmarks/Ptrdist/ks/ks.test | 2768 | 2764 | -0.1% |
| test-suite...Source/Benchmarks/sim/sim.test | 8712 | 8704 | -0.1% |
| test-suite...s/MallocBench/cfrac/cfrac.test | 12360 | 12352 | -0.1% |
| test-suite...lFlow-dbl/ControlFlow-dbl.test | 12896 | 12888 | -0.1% |
| test-suite...chmarks/MallocBench/gs/gs.test | 78160 | 78112 | -0.1% |
| test-suite...lications/sqlite3/sqlite3.test | 168436 | 168340 | -0.1% |
| test-suite...telecomm-gsm/telecomm-gsm.test | 15012 | 15004 | -0.1% |
| test-suite...ediabench/gsm/toast/toast.test | 15012 | 15004 | -0.1% |
| test-suite...urce/Applications/hbd/hbd.test | 18504 | 18496 | -0.0% |
| test-suite...encode/alacconvert-encode.test | 19924 | 19916 | -0.0% |
| test-suite...decode/alacconvert-decode.test | 19924 | 19916 | -0.0% |
| test-suite.../Benchmarks/Ptrdist/bc/bc.test | 20752 | 20744 | -0.0% |
| test-suite...BLambdaLoops/lcalsBLambda.test | 85764 | 85732 | -0.0% |
| test-suite...pplications/oggenc/oggenc.test | 90176 | 90144 | -0.0% |
| test-suite...SubsetCRawLoops/lcalsCRaw.test | 90532 | 90500 | -0.0% |
| test-suite...CLambdaLoops/lcalsCLambda.test | 90628 | 90596 | -0.0% |
| test-suite...ks/Prolangs-C/agrep/agrep.test | 23884 | 23876 | -0.0% |
| test-suite...lFlow-flt/ControlFlow-flt.test | 13384 | 13380 | -0.0% |
| test-suite...lications/ClamAV/clamscan.test | 245996 | 245924 | -0.0% |
| test-suite...terchange/LoopInterchange.test | 59128 | 59112 | -0.0% |
| test-suite...eProcessing/Dilate/Dilate.test | 60376 | 60360 | -0.0% |
| test-suite...Filtering/BilateralFilter.test | 60632 | 60616 | -0.0% |
| test-suite...sion/AnisotropicDiffusion.test | 60680 | 60664 | -0.0% |
| test-suite...ImageProcessing/Blur/blur.test | 61016 | 61000 | -0.0% |
| test-suite...eProcessing/Dither/Dither.test | 61304 | 61288 | -0.0% |
| test-suite...urce/Applications/lua/lua.test | 61520 | 61504 | -0.0% |
| test-suite...yApps-C++/PENNANT/PENNANT.test | 32276 | 32268 | -0.0% |
| test-suite...ProxyApps-C++/CLAMR/CLAMR.test | 217388 | 217340 | -0.0% |
| test-suite...-typeset/consumer-typeset.test | 279140 | 279084 | -0.0% |
| test-suite.../Applications/SPASS/SPASS.test | 201528 | 201488 | -0.0% |
| test-suite...ications/JM/ldecod/ldecod.test | 128356 | 128332 | -0.0% |
| test-suite...SubsetBRawLoops/lcalsBRaw.test | 85748 | 85732 | -0.0% |
| test-suite...plications/d/make_dparser.test | 43956 | 43964 | 0.0% |
| test-suite...SubsetARawLoops/lcalsARaw.test | 88532 | 88516 | -0.0% |
| test-suite...ALambdaLoops/lcalsALambda.test | 89396 | 89380 | -0.0% |
| test-suite...arks/mafft/pairlocalalign.test | 168656 | 168632 | -0.0% |
| test-suite...nsumer-jpeg/consumer-jpeg.test | 60000 | 59992 | -0.0% |
| test-suite...abench/jpeg/jpeg-6a/cjpeg.test | 61920 | 61912 | -0.0% |
| test-suite...ce/Benchmarks/PAQ8p/paq8p.test | 40636 | 40632 | -0.0% |
| test-suite...CI_Purple/SMG2000/smg2000.test | 89536 | 89544 | 0.0% |
| test-suite...rks/tramp3d-v4/tramp3d-v4.test | 198420 | 198404 | -0.0% |
| test-suite...ications/JM/lencod/lencod.test | 317976 | 317952 | -0.0% |
| test-suite...Applications/kimwitu++/kc.test | 241500 | 241492 | -0.0% |
| test-suite.../Benchmarks/Bullet/bullet.test | 296420 | 296412 | -0.0% |
| test-suite...marks/7zip/7zip-benchmark.test | 323580 | 323584 | 0.0% |
| test-suite...peg2/mpeg2dec/mpeg2decode.test | 22968 | 22976 | 0.0% |
| test-suite...cations/hexxagon/hexxagon.test | 7224 | 7228 | 0.1% |
| test-suite...s/Ptrdist/anagram/anagram.test | 1940 | 1944 | 0.2% |
| test-suite...Adobe-C++/stepanov_vector.test | 7888 | 7904 | 0.2% |
| test-suite...-C++/stepanov_abstraction.test | 6340 | 6356 | 0.3% |
| Geomean difference | | | -0.0% |
|
| | Pre-Patch | Post-Patch | diff |
| ----- | ------------- | ------------- | ---------- |
| count | 310.000000 | 310.000000 | 310.000000 |
| mean | 19626.800000 | 19624.077419 | -0.000062 |
| std | 48727.318461 | 48720.664877 | 0.000428 |
| min | 292.000000 | 292.000000 | -0.003690 |
| 25% | 1090.000000 | 1090.000000 | 0.000000 |
| 50% | 2772.000000 | 2770.000000 | 0.000000 |
| 75% | 10185.000000 | 10185.000000 | 0.000000 |
| max | 323580.000000 | 323584.000000 | 0.002524 |
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83667
Files:
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/test/CodeGen/Thumb2/constant-hoisting.ll
Index: llvm/test/CodeGen/Thumb2/constant-hoisting.ll
===================================================================
--- llvm/test/CodeGen/Thumb2/constant-hoisting.ll
+++ llvm/test/CodeGen/Thumb2/constant-hoisting.ll
@@ -37,26 +37,25 @@
; CHECK-V7M: mov r2, r0
; CHECK-V7M-NEXT: ldr r0, .LCPI0_0
; CHECK-V7M-NEXT: cmp r2, #50
-; CHECK-V7M-NEXT: beq .LBB0_5
+; CHECK-V7M-NEXT: beq .LBB0_3
; CHECK-V7M-NEXT: cmp r2, #1
-; CHECK-V7M-NEXT: beq .LBB0_7
+; CHECK-V7M-NEXT: ittt eq
+; CHECK-V7M-NEXT: addeq r0, r1
+; CHECK-V7M-NEXT: addseq r0, #1
+; CHECK-V7M-NEXT: bxeq lr
; CHECK-V7M-NEXT: cmp r2, #30
-; CHECK-V7M-NEXT: beq .LBB0_8
-; CHECK-V7M-NEXT: cbnz r2, .LBB0_6
+; CHECK-V7M-NEXT: ittt eq
+; CHECK-V7M-NEXT: addeq r0, r1
+; CHECK-V7M-NEXT: addseq r0, #2
+; CHECK-V7M-NEXT: bxeq lr
+; CHECK-V7M-NEXT: cbnz r2, .LBB0_4
+; CHECK-V7M-NEXT: .LBB0_2:
; CHECK-V7M-NEXT: add r0, r1
; CHECK-V7M-NEXT: bx lr
-; CHECK-V7M-NEXT: .LBB0_5:
+; CHECK-V7M-NEXT: .LBB0_3:
; CHECK-V7M-NEXT: add r0, r1
; CHECK-V7M-NEXT: adds r0, #4
-; CHECK-V7M-NEXT: .LBB0_6:
-; CHECK-V7M-NEXT: bx lr
-; CHECK-V7M-NEXT: .LBB0_7:
-; CHECK-V7M-NEXT: add r0, r1
-; CHECK-V7M-NEXT: adds r0, #1
-; CHECK-V7M-NEXT: bx lr
-; CHECK-V7M-NEXT: .LBB0_8:
-; CHECK-V7M-NEXT: add r0, r1
-; CHECK-V7M-NEXT: adds r0, #2
+; CHECK-V7M-NEXT: .LBB0_4:
; CHECK-V7M-NEXT: bx lr
; CHECK-V7M-NEXT: .p2align 2
; CHECK-V7M-NEXT: .LCPI0_0:
Index: llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
===================================================================
--- llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -574,7 +574,7 @@
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
const MachineOperand &MO = MI.getOperand(i);
if ((MO.isRegMask() && MO.clobbersPhysReg(ARM::CPSR)) ||
- (MO.isReg() && MO.isDef() && MO.getReg() == ARM::CPSR)) {
+ (MO.isReg() && MO.isDef() && MO.getReg() == ARM::CPSR && !MO.isDead())) {
Pred.push_back(MO);
Found = true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83667.277366.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/7a591bc8/attachment.bin>
More information about the llvm-commits
mailing list