summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2013-10-17 11:02:58 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2013-10-17 11:02:58 +0000
commit561badf717089f5c5afe21afc44a96e9bedf9ec3 (patch)
treee9a4bfde75d972dcef35b17aa5dafe41c5131807 /llvm/test/CodeGen
parent21a9c93a4d1551474dd65c8da1c8fc3f2848455d (diff)
downloadbcm5719-llvm-561badf717089f5c5afe21afc44a96e9bedf9ec3.tar.gz
bcm5719-llvm-561badf717089f5c5afe21afc44a96e9bedf9ec3.zip
Fix edge condition in DAGCombiner to improve codegen of shift sequences.
When canonicalizing dags according to the rule (shl (zext (shr X, c1) ), c1) ==> (zext (shl (shr X, c1), c1)) remember to add the new shl dag to the DAGCombiner worklist of nodes. If we don't explicitly add it to the worklist of nodes to visit, we may not trigger later on the rule that folds the shift left + logical shift right into a AND instruction with bitmask. llvm-svn: 192883
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/dagcombine-shifts.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/dagcombine-shifts.ll b/llvm/test/CodeGen/X86/dagcombine-shifts.ll
index e5a67d7efc1..905cf052c39 100644
--- a/llvm/test/CodeGen/X86/dagcombine-shifts.ll
+++ b/llvm/test/CodeGen/X86/dagcombine-shifts.ll
@@ -187,6 +187,8 @@ entry:
; Once the add is removed, the number of uses becomes one and therefore the
; dags are canonicalized. After Legalization, we need to make sure that the
; valuetype for the shift count is legal.
+; Verify also that we correctly fold the shl-shr sequence into an
+; AND with bitmask.
define void @g(i32 %a) {
%b = lshr i32 %a, 2
@@ -197,5 +199,11 @@ define void @g(i32 %a) {
ret void
}
+; CHECK-LABEL: @g
+; CHECK-NOT: shr
+; CHECK-NOT: shl
+; CHECK: and
+; CHECK-NEXT: jmp
+
declare void @f(i64)
OpenPOWER on IntegriCloud