llvm.org GIT mirror llvm / 37cdad3
Fix the position of MemOperands in nodes that use variadic_ops in DAGISelEmitter output. This bug was recently uncovered by the addition of patterns for CALL32m and CALL64m, which are nodes that now have both MemOperands and variadic_ops. This bug was especially visible with PIC in various configurations, because the new patterns are matching the indirect call code used in many PIC configurations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51877 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 12 years ago
2 changed file(s) with 26 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as < %s | llc -relocation-model=pic -code-model=large
1
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
3 target triple = "x86_64-apple-darwin8"
4
5 declare void @xscanf(i64) nounwind
6
7 define void @foo() nounwind {
8 call void (i64)* @xscanf( i64 0 ) nounwind
9 unreachable
10 }
991991 }
992992 }
993993
994 // Generate MemOperandSDNodes nodes for each memory accesses covered by
995 // this pattern.
996 if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
997 std::vector::const_iterator mi, mie;
998 for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
999 emitCode("SDOperand LSI_" + *mi + " = "
1000 "CurDAG->getMemOperand(cast(" +
1001 *mi + ")->getMemOperand());");
1002 AllOps.push_back("LSI_" + *mi);
1003 }
1004 }
1005
1006994 // Emit all the chain and CopyToReg stuff.
1007995 bool ChainEmitted = NodeHasChain;
1008996 if (NodeHasChain)
10851073 emitCode(" AddToISelQueue(N.getOperand(i));");
10861074 emitCode(" Ops" + utostr(OpsNo) + ".push_back(N.getOperand(i));");
10871075 emitCode("}");
1076 }
1077
1078 // Generate MemOperandSDNodes nodes for each memory accesses covered by
1079 // this pattern.
1080 if (II.isSimpleLoad | II.mayLoad | II.mayStore) {
1081 std::vector::const_iterator mi, mie;
1082 for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {
1083 emitCode("SDOperand LSI_" + *mi + " = "
1084 "CurDAG->getMemOperand(cast(" +
1085 *mi + ")->getMemOperand());");
1086 if (IsVariadic)
1087 emitCode("Ops" + utostr(OpsNo) + ".push_back(LSI_" + *mi + ");");
1088 else
1089 AllOps.push_back("LSI_" + *mi);
1090 }
10881091 }
10891092
10901093 if (NodeHasChain) {