ports/devel/llvm/files/patch-svn-r170353
Brooks Davis e6d37282b2 Apply several upstream svn revisions that have also been merged to the
base version:

r170353:
Fix another SROA crasher, PR14601.

This was a silly oversight, we weren't pruning allocas which were used
by variable-length memory intrinsics from the set that could be widened
and promoted as integers. Fix that.

r175057:
X86: Disable generation of rep;movsl when %esi is used as a base pointer.

This happens when there is both stack realignment and a dynamic alloca in the
function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the
base pointer and the next register spill will write into oblivion.

Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas
and freebsd a 4 byte stack alignment.

r175360:
MCParser: Reject .balign with non-pow2 alignments.

GNU as rejects them and there are configure scripts in the wild that check if
the assembler rejects ".align 3" to determine whether the alignment is in bytes
or powers of two.

r175962:
X86: Disable cmov-memory patterns on subtargets without cmov.

PR:		ports/176269, ports/176893, ports/176967
Requested by:	tijl, dim, others
2013-05-22 21:52:59 +00:00

46 lines
1.7 KiB
Text

$FreeBSD$
------------------------------------------------------------------------
r170353 | chandlerc | 2012-12-17 18:48:07 +0000 (Mon, 17 Dec 2012) | 5 lines
Fix another SROA crasher, PR14601.
This was a silly oversight, we weren't pruning allocas which were used
by variable-length memory intrinsics from the set that could be widened
and promoted as integers. Fix that.
------------------------------------------------------------------------
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp (revision 170352)
+++ lib/Transforms/Scalar/SROA.cpp (revision 170353)
@@ -2150,7 +2150,7 @@
!canConvertValue(TD, ValueTy, AllocaTy))
return false;
} else if (MemIntrinsic *MI = dyn_cast<MemIntrinsic>(I->U->getUser())) {
- if (MI->isVolatile())
+ if (MI->isVolatile() || !isa<Constant>(MI->getLength()))
return false;
if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(I->U->getUser())) {
const AllocaPartitioning::MemTransferOffsets &MTO
Index: test/Transforms/SROA/basictest.ll
===================================================================
--- test/Transforms/SROA/basictest.ll (revision 170352)
+++ test/Transforms/SROA/basictest.ll (revision 170353)
@@ -1208,3 +1208,18 @@
ret i32 %y
; CHECK: ret i32
}
+
+define i32 @PR14601(i32 %x) {
+; Don't try to form a promotable integer alloca when there is a variable length
+; memory intrinsic.
+; CHECK: @PR14601
+
+entry:
+ %a = alloca i32
+; CHECK: alloca
+
+ %a.i8 = bitcast i32* %a to i8*
+ call void @llvm.memset.p0i8.i32(i8* %a.i8, i8 0, i32 %x, i32 1, i1 false)
+ %v = load i32* %a
+ ret i32 %v
+}