llvm.org GIT mirror llvm / eb7e3df
Reapply "[SimplifyCFG] Be more aggressive" on branch_37 I have underestimated the importance of this patch, and James has got a fix for it in the making. Sorry for the noise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@245570 91177308-0d34-0410-b5e6-96231b3b80d8 Renato Golin 5 years ago
3 changed file(s) with 15 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
5252
5353 #define DEBUG_TYPE "simplifycfg"
5454
55 // Chosen as 2 so as to be cheap, but still to have enough power to fold
56 // a select, so the "clamp" idiom (of a min followed by a max) will be caught.
57 // To catch this, we need to fold a compare and a select, hence '2' being the
58 // minimum reasonable default.
5559 static cl::opt
56 PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(1),
57 cl::desc("Control the amount of phi node folding to perform (default = 1)"));
60 PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(2),
61 cl::desc("Control the amount of phi node folding to perform (default = 2)"));
5862
5963 static cl::opt
6064 DupRet("simplifycfg-dup-ret", cl::Hidden, cl::init(false),
0 ; RUN: llc -O3 -mcpu=cortex-a57 < %s | FileCheck %s
11
2 ; CHECK-LABLE: @test
3 ; CHECK: tst [[CMP:x[0-9]+]], #0x8000000000000000
4 ; CHECK: csel [[R0:x[0-9]+]], [[S0:x[0-9]+]], [[S1:x[0-9]+]], eq
5 ; CHECK: csel [[R1:x[0-9]+]], [[S2:x[0-9]+]], [[S3:x[0-9]+]], eq
2 ; CHECK-LABEL: @test
3 ; CHECK: and
4 ; CHECK: csel
5 ; CHECK: csel
66 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
77 target triple = "arm64--linux-gnueabi"
88
134134 ; In stress mode, constant vector are promoted
135135 ; Since, the constant is the same as the previous function,
136136 ; the same address must be used
137 ; PROMOTED: adrp [[PAGEADDR:x[0-9]+]], [[CSTV1]]@PAGE
138 ; PROMOTED-NEXT: ldr q[[REGNUM:[0-9]+]], {{\[}}[[PAGEADDR]], [[CSTV1]]@PAGEOFF]
139 ; PROMOTED-NEXT: cbz w0, [[LABEL:LBB.*]]
140 ; Next BB
141 ; PROMOTED: add.16b [[DESTV:v[0-9]+]], v0, v[[REGNUM]]
142 ; PROMOTED-NEXT: mul.16b v[[REGNUM]], [[DESTV]], v[[REGNUM]]
143 ; Next BB
144 ; PROMOTED-NEXT: [[LABEL]]:
145 ; PROMOTED-NEXT: mul.16b [[TMP1:v[0-9]+]], v[[REGNUM]], v[[REGNUM]]
146 ; PROMOTED-NEXT: mul.16b [[TMP2:v[0-9]+]], [[TMP1]], [[TMP1]]
147 ; PROMOTED-NEXT: mul.16b [[TMP3:v[0-9]+]], [[TMP2]], [[TMP2]]
148 ; PROMOTED-NEXT: mul.16b v0, [[TMP3]], [[TMP3]]
149 ; PROMOTED-NEXT: ret
137 ; PROMOTED: ldr
138 ; PROMOTED-NOT: ldr
139 ; PROMOTED: ret
150140
151141 ; REGULAR-LABEL: test5:
152 ; REGULAR: cbz w0, [[LABELelse:LBB.*]]
153 ; Next BB
154 ; REGULAR: adrp [[PAGEADDR:x[0-9]+]], [[CSTLABEL:lCP.*]]@PAGE
155 ; REGULAR-NEXT: ldr q[[REGNUM:[0-9]+]], {{\[}}[[PAGEADDR]], [[CSTLABEL]]@PAGEOFF]
156 ; REGULAR-NEXT: add.16b [[DESTV:v[0-9]+]], v0, v[[REGNUM]]
157 ; REGULAR-NEXT: mul.16b v[[DESTREGNUM:[0-9]+]], [[DESTV]], v[[REGNUM]]
158 ; REGULAR-NEXT: b [[LABELend:LBB.*]]
159 ; Next BB
160 ; REGULAR-NEXT: [[LABELelse]]
161 ; REGULAR-NEXT: adrp [[PAGEADDR:x[0-9]+]], [[CSTLABEL:lCP.*]]@PAGE
162 ; REGULAR-NEXT: ldr q[[DESTREGNUM]], {{\[}}[[PAGEADDR]], [[CSTLABEL]]@PAGEOFF]
163 ; Next BB
164 ; REGULAR-NEXT: [[LABELend]]:
165 ; REGULAR-NEXT: mul.16b [[TMP1:v[0-9]+]], v[[DESTREGNUM]], v[[DESTREGNUM]]
166 ; REGULAR-NEXT: mul.16b [[TMP2:v[0-9]+]], [[TMP1]], [[TMP1]]
167 ; REGULAR-NEXT: mul.16b [[TMP3:v[0-9]+]], [[TMP2]], [[TMP2]]
168 ; REGULAR-NEXT: mul.16b v0, [[TMP3]], [[TMP3]]
169 ; REGULAR-NEXT: ret
142 ; REGULAR: ldr
143 ; REGULAR: ret
170144 entry:
171145 %tobool = icmp eq i32 %path, 0
172146 br i1 %tobool, label %if.end, label %if.then