llvm.org GIT mirror llvm / a2177aa
Merging r332680: ------------------------------------------------------------------------ r332680 | kfischer | 2018-05-17 17:40:52 -0700 (Thu, 17 May 2018) | 13 lines [X86DomainReassignment] Don't delete IMPLICIT_DEF nodes Summary: We cannot simply delete IMPLICIT_DEF nodes. They may be used later (e.g. by a PHI) and deleting them will cause later passes (e.g. LiveVariables) to crash. However, it seems fine to ignore them for purposes of the domain reassignment (as we do with PHI). Fixes PR37430 Fixes JuliaLang/julia#27080 Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46797 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@333469 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 1 year, 4 months ago
2 changed file(s) with 25 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
252252 BuildMI(*MI->getParent(), MI, MI->getDebugLoc(),
253253 TII->get(TargetOpcode::COPY))
254254 .add({MI->getOperand(0), MI->getOperand(SrcOpIdx)});
255 return true;
256 }
257
258 double getExtraCost(const MachineInstr *MI,
259 MachineRegisterInfo *MRI) const override {
260 return 0;
261 }
262 };
263
264 /// An Instruction Converter which completely deletes an instruction.
265 /// For example, IMPLICIT_DEF instructions can be deleted when converting from
266 /// GPR to mask.
267 class InstrDeleter : public InstrConverterBase {
268 public:
269 InstrDeleter(unsigned SrcOpcode) : InstrConverterBase(SrcOpcode) {}
270
271 bool convertInstr(MachineInstr *MI, const TargetInstrInfo *TII,
272 MachineRegisterInfo *MRI) const override {
273 assert(isLegal(MI, TII) && "Cannot convert instruction");
274255 return true;
275256 }
276257
586567 new InstrIgnore(TargetOpcode::PHI);
587568
588569 Converters[{MaskDomain, TargetOpcode::IMPLICIT_DEF}] =
589 new InstrDeleter(TargetOpcode::IMPLICIT_DEF);
570 new InstrIgnore(TargetOpcode::IMPLICIT_DEF);
590571
591572 Converters[{MaskDomain, TargetOpcode::INSERT_SUBREG}] =
592573 new InstrReplaceWithCopy(TargetOpcode::INSERT_SUBREG, 2);
0 ; RUN: llc -mcpu=skylake-avx512 -mtriple=x86_64-unknown-linux-gnu %s -o - | FileCheck %s
1
2 ; Check that the X86 Domain Reassignment pass doesn't drop IMPLICIT_DEF nodes,
3 ; which would later cause crashes (e.g. in LiveVariables) - see PR37430
4 define void @domain_reassignment_implicit_def(i1 %cond, i8 *%mem, float %arg) {
5 ; CHECK: vxorps %xmm1, %xmm1, %xmm1
6 ; CHECK: vcmpneqss %xmm1, %xmm0, %k0
7 ; CHECK: kmovb %k0, (%rsi)
8 top:
9 br i1 %cond, label %L19, label %L15
10
11 L15: ; preds = %top
12 %tmp47 = fcmp une float 0.000000e+00, %arg
13 %tmp48 = zext i1 %tmp47 to i8
14 br label %L21
15
16 L19: ; preds = %top
17 br label %L21
18
19 L21: ; preds = %L19, %L15
20 %.sroa.0.0 = phi i8 [ undef, %L19 ], [ %tmp48, %L15 ]
21 store i8 %.sroa.0.0, i8* %mem, align 1
22 ret void
23 }