summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/2009-03-12-CPAlignBug.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-03-13 07:51:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-03-13 07:51:59 +0000
commit1606e8e4cd937e6de6681f686c266cf61722d972 (patch)
tree0d2dbc91243124186225e830c6b575acc009f33f /test/CodeGen/X86/2009-03-12-CPAlignBug.ll
parent79a5cef503c54f07be27c078267df6170cc6390a (diff)
downloadllvm-1606e8e4cd937e6de6681f686c266cf61722d972.tar.gz
llvm-1606e8e4cd937e6de6681f686c266cf61722d972.tar.bz2
llvm-1606e8e4cd937e6de6681f686c266cf61722d972.tar.xz
Fix some significant problems with constant pools that resulted in unnecessary paddings between constant pool entries, larger than necessary alignments (e.g. 8 byte alignment for .literal4 sections), and potentially other issues.
1. ConstantPoolSDNode alignment field is log2 value of the alignment requirement. This is not consistent with other SDNode variants. 2. MachineConstantPool alignment field is also a log2 value. 3. However, some places are creating ConstantPoolSDNode with alignment value rather than log2 values. This creates entries with artificially large alignments, e.g. 256 for SSE vector values. 4. Constant pool entry offsets are computed when they are created. However, asm printer group them by sections. That means the offsets are no longer valid. However, asm printer uses them to determine size of padding between entries. 5. Asm printer uses expensive data structure multimap to track constant pool entries by sections. 6. Asm printer iterate over SmallPtrSet when it's emitting constant pool entries. This is non-deterministic. Solutions: 1. ConstantPoolSDNode alignment field is changed to keep non-log2 value. 2. MachineConstantPool alignment field is also changed to keep non-log2 value. 3. Functions that create ConstantPool nodes are passing in non-log2 alignments. 4. MachineConstantPoolEntry no longer keeps an offset field. It's replaced with an alignment field. Offsets are not computed when constant pool entries are created. They are computed on the fly in asm printer and JIT. 5. Asm printer uses cheaper data structure to group constant pool entries. 6. Asm printer compute entry offsets after grouping is done. 7. Change JIT code to compute entry offsets on the fly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2009-03-12-CPAlignBug.ll')
-rw-r--r--test/CodeGen/X86/2009-03-12-CPAlignBug.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2009-03-12-CPAlignBug.ll b/test/CodeGen/X86/2009-03-12-CPAlignBug.ll
new file mode 100644
index 0000000000..75af992d1d
--- /dev/null
+++ b/test/CodeGen/X86/2009-03-12-CPAlignBug.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+sse2 | not grep {.space}
+; rdar://6668548
+
+declare double @llvm.sqrt.f64(double) nounwind readonly
+
+declare double @fabs(double)
+
+declare double @llvm.pow.f64(double, double) nounwind readonly
+
+define void @SolveCubic_bb1(i32* %solutions, double* %x, x86_fp80 %.reload, x86_fp80 %.reload5, x86_fp80 %.reload6, double %.reload8) nounwind {
+newFuncRoot:
+ br label %bb1
+
+bb1.ret.exitStub: ; preds = %bb1
+ ret void
+
+bb1: ; preds = %newFuncRoot
+ store i32 1, i32* %solutions, align 4
+ %0 = tail call double @llvm.sqrt.f64(double %.reload8) ; <double> [#uses=1]
+ %1 = fptrunc x86_fp80 %.reload6 to double ; <double> [#uses=1]
+ %2 = tail call double @fabs(double %1) nounwind readnone ; <double> [#uses=1]
+ %3 = add double %0, %2 ; <double> [#uses=1]
+ %4 = tail call double @llvm.pow.f64(double %3, double 0x3FD5555555555555) ; <double> [#uses=1]
+ %5 = fpext double %4 to x86_fp80 ; <x86_fp80> [#uses=2]
+ %6 = fdiv x86_fp80 %.reload5, %5 ; <x86_fp80> [#uses=1]
+ %7 = add x86_fp80 %5, %6 ; <x86_fp80> [#uses=1]
+ %8 = fptrunc x86_fp80 %7 to double ; <double> [#uses=1]
+ %9 = fcmp olt x86_fp80 %.reload6, 0xK00000000000000000000 ; <i1> [#uses=1]
+ %iftmp.6.0 = select i1 %9, double 1.000000e+00, double -1.000000e+00 ; <double> [#uses=1]
+ %10 = mul double %8, %iftmp.6.0 ; <double> [#uses=1]
+ %11 = fpext double %10 to x86_fp80 ; <x86_fp80> [#uses=1]
+ %12 = fdiv x86_fp80 %.reload, 0xKC000C000000000000000 ; <x86_fp80> [#uses=1]
+ %13 = add x86_fp80 %11, %12 ; <x86_fp80> [#uses=1]
+ %14 = fptrunc x86_fp80 %13 to double ; <double> [#uses=1]
+ store double %14, double* %x, align 1
+ br label %bb1.ret.exitStub
+}