llvm.org GIT mirror llvm / 672452d
Disable the load-shrinking optimization from looking at anything larger than 64-bits, avoiding a crash. This should really be fixed to use APInts, though type legalization happens to help us out and we get good code on the attached testcase at least. This fixes rdar://6836460 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70360 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
2 changed file(s) with 22 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
15371537 N0.getOperand(0).getNode()->hasOneUse() &&
15381538 isa(N0.getOperand(1))) {
15391539 LoadSDNode *Lod = cast(N0.getOperand(0));
1540 uint64_t Mask = cast(N0.getOperand(1))->getZExtValue();
15411540 uint64_t bestMask = 0;
15421541 unsigned bestWidth = 0, bestOffset = 0;
1543 if (!Lod->isVolatile() && Lod->isUnindexed()) {
1542 if (!Lod->isVolatile() && Lod->isUnindexed() &&
1543 // FIXME: This uses getZExtValue() below so it only works on i64 and
1544 // below.
1545 N0.getValueType().getSizeInBits() <= 64) {
15441546 unsigned origWidth = N0.getValueType().getSizeInBits();
15451547 // We can narrow (e.g.) 16-bit extending loads on 32-bit target to
15461548 // 8 bits, but have to be careful...
15471549 if (Lod->getExtensionType() != ISD::NON_EXTLOAD)
15481550 origWidth = Lod->getMemoryVT().getSizeInBits();
1551 uint64_t Mask =cast(N0.getOperand(1))->getZExtValue();
15491552 for (unsigned width = origWidth / 2; width>=8; width /= 2) {
15501553 uint64_t newMask = (1ULL << width) - 1;
15511554 for (unsigned offset=0; offset
1552 if ((newMask & Mask)==Mask) {
1555 if ((newMask & Mask) == Mask) {
15531556 if (!TD->isLittleEndian())
15541557 bestOffset = (origWidth/width - offset - 1) * (width/8);
15551558 else
0 ; RUN: llvm-as < %s | llc
1 ; rdar://6836460
2
3 define i32 @test(i128* %P) nounwind {
4 entry:
5 %tmp48 = load i128* %P
6 %and49 = and i128 %tmp48, 18446744073709551616 ; [#uses=1]
7 %tobool = icmp ne i128 %and49, 0 ; [#uses=1]
8 br i1 %tobool, label %if.then50, label %if.end61
9
10 if.then50: ; preds = %if.then20
11 ret i32 1241
12
13 if.end61: ; preds = %if.then50, %if.then20, %entry
14 ret i32 123
15 }