61 lines · plain
1; RUN: llc < %s | FileCheck %s2 3; This testcase used to hit an assert during ISel. For details, see the big4; comment inside the function.5 6; CHECK-LABEL: foo:7; The AND should be turned into a subreg access.8; CHECK-NOT: and9; The shift (leal) should be folded into the scale of the address in the load.10; CHECK-NOT: leal11; CHECK: movl {{.*}},4),12 13target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"14target triple = "i386-apple-macosx10.6.0"15 16define void @foo(i32 %a) {17bb:18 br label %bb169219 20bb1692:21 %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ]22 %xor = xor i32 0, %tmp169423 24; %load1 = (load (and (shl %xor, 2), 1020))25 %tmp1701 = shl i32 %xor, 226 %tmp1702 = and i32 %tmp1701, 102027 %tmp1703 = getelementptr inbounds [1028 x i8], ptr null, i32 0, i32 %tmp170228 %load1 = load i32, ptr %tmp1703, align 429 30; %load2 = (load (shl (and %xor, 255), 2))31 %tmp1698 = and i32 %xor, 25532 %tmp1706 = shl i32 %tmp1698, 233 %tmp1707 = getelementptr inbounds [1028 x i8], ptr null, i32 0, i32 %tmp170634 %load2 = load i32, ptr %tmp1707, align 435 36 %tmp1710 = or i32 %load2, %a37 38; While matching xor we address-match %load1. The and-of-shift reassocication39; in address matching transform this into into a shift-of-and and the resuting40; node becomes identical to %load2. CSE replaces %load1 which leaves its41; references in MatchScope and RecordedNodes stale.42 %tmp1711 = xor i32 %load1, %tmp171043 44 %tmp1744 = getelementptr inbounds [256 x i32], ptr null, i32 0, i32 %tmp171145 store i32 0, ptr %tmp1744, align 446 %tmp1745 = add i32 %tmp1694, 147 indirectbr ptr undef, [label %bb1756, label %bb1692]48 49bb1756:50 br label %bb270551 52bb2705:53 indirectbr ptr undef, [label %bb5721, label %bb5736]54 55bb5721:56 br label %bb270557 58bb5736:59 ret void60}61