llvm.org GIT mirror llvm / b44101c
Implement support for fast isel of calls of i1 arguments, even though they are illegal, when they are a truncate from something else. This eliminates fully half of all the fastisel rejections on a test c++ file I'm working with, which should make a substantial improvement for -O0 compile of c++ code. This fixed rdar://9297003 - fast isel bails out on all functions taking bools git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129752 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 36 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
7777
7878 bool X86FastEmitLoad(EVT VT, const X86AddressMode &AM, unsigned &RR);
7979
80 bool X86FastEmitStore(EVT VT, const Value *Val,
81 const X86AddressMode &AM);
82 bool X86FastEmitStore(EVT VT, unsigned Val,
83 const X86AddressMode &AM);
80 bool X86FastEmitStore(EVT VT, const Value *Val, const X86AddressMode &AM);
81 bool X86FastEmitStore(EVT VT, unsigned Val, const X86AddressMode &AM);
8482
8583 bool X86FastEmitExtend(ISD::NodeType Opc, EVT DstVT, unsigned Src, EVT SrcVT,
8684 unsigned &ResultReg);
224222 /// and a displacement offset, or a GlobalAddress,
225223 /// i.e. V. Return true if it is possible.
226224 bool
227 X86FastISel::X86FastEmitStore(EVT VT, unsigned Val,
228 const X86AddressMode &AM) {
225 X86FastISel::X86FastEmitStore(EVT VT, unsigned Val, const X86AddressMode &AM) {
229226 // Get opcode and regclass of the output for the given store instruction.
230227 unsigned Opc = 0;
231228 switch (VT.getSimpleVT().SimpleTy) {
15361533 }
15371534 }
15381535
1539 unsigned Arg = getRegForValue(ArgVal);
1540 if (Arg == 0)
1541 return false;
1536 unsigned ArgReg;
1537 if (ArgVal->getType()->isIntegerTy(1) && isa(ArgVal) &&
1538 cast(ArgVal)->getParent() == I->getParent() &&
1539 ArgVal->hasOneUse()) {
1540 // Passing bools around ends up doing a trunc to i1 and passing it.
1541 // Codegen this as an argument + "and 1".
1542 ArgVal = cast(ArgVal)->getOperand(0);
1543 ArgReg = getRegForValue(ArgVal);
1544 if (ArgReg == 0) return false;
1545
1546 MVT ArgVT;
1547 if (!isTypeLegal(ArgVal->getType(), ArgVT)) return false;
1548
1549 ArgReg = FastEmit_ri(ArgVT, ArgVT, ISD::AND, ArgReg,
1550 ArgVal->hasOneUse(), 1);
1551 } else {
1552 ArgReg = getRegForValue(ArgVal);
1553 if (ArgReg == 0) return false;
1554 }
15421555
15431556 // FIXME: Only handle *easy* calls for now.
15441557 if (CS.paramHasAttr(AttrInd, Attribute::InReg) ||
15541567 unsigned OriginalAlignment = TD.getABITypeAlignment(ArgTy);
15551568 Flags.setOrigAlign(OriginalAlignment);
15561569
1557 Args.push_back(Arg);
1570 Args.push_back(ArgReg);
15581571 ArgVals.push_back(ArgVal);
15591572 ArgVTs.push_back(ArgVT);
15601573 ArgFlags.push_back(Flags);
156156 ; CHECK-NEXT: callq
157157 }
158158
159
160
161 ; rdar://9297003 - fast isel bails out on all functions taking bools
162 define void @test14(i8 %tmp) nounwind ssp noredzone {
163 entry:
164 %tobool = trunc i8 %tmp to i1
165 call void @test13f(i1 zeroext %tobool) noredzone
166 ret void
167 ; CHECK: test14:
168 ; CHECK: andb $1,
169 ; CHECK: callq
170 }
171