<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69875>69875</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
TwoAddressInstructionPass crash when execute
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
r00t0s
</td>
</tr>
</table>
<pre>
I try generate assembly code but when i execute it cause me error after execute, [in clang or llc is normally generated so it may be visual studio problem?]
```
std::string IR = "\n\
define void @disasm() local_unnamed_addr #0 {\n\
entry:\n\
%0 = tail call i64 asm \"\", \"={rsp},~{dirflag},~{fpsr},~{flags}\"() #0\n\
%1 = add i64 %0, 8\n\
tail call void asm \"\", \"{rsp},~{dirflag},~{fpsr},~{flags}\"(i64 %1) #0\n\
ret void\n\
}";
InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
InitializeAllAsmParsers();
LLVMContext Context;
SMDiagnostic SMError;
std::unique_ptr<Module> Mod = parseIR(MemoryBufferRef(IR, "IR"), SMError, Context);
Module* M = Mod.get();
if (!M) {
return SMError.getMessage().str();
}
Triple TargetTriple(M->getTargetTriple());
if (TargetTriple.getTriple().empty()) {
TargetTriple.setTriple(sys::getDefaultTargetTriple());
}
std::string SErrorr;
const Target* TheTarget = TargetRegistry::lookupTarget(TargetTriple.getTriple(), SErrorr);
SubtargetFeatures Features;
StringMap<bool> HostFeatures;
if (sys::getHostCPUFeatures(HostFeatures)) {
for (StringMapEntry<bool>& F : HostFeatures) {
Features.AddFeature(F.first(), F.second);
}
}
TargetOptions TOptions;
TOptions.EnableIPRA = true;
std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine(TargetTriple.getTriple(), sys::getHostCPUName(), Features.getString(), TOptions, std::nullopt, std::nullopt, CodeGenOpt::Default));
M->setDataLayout(TM->createDataLayout());
std::string MIRString;
llvm::raw_string_ostream MIRStream(MIRString);
legacy::PassManager PM;
LLVMTargetMachine& LLVMTM = static_cast<LLVMTargetMachine&>(*TM);
MachineModuleInfoWrapperPass* MMIWP = new MachineModuleInfoWrapperPass(&LLVMTM);
AddPassesToGenerateCode(LLVMTM, PM, true, *MMIWP);
PM.add(createPrintMIRPass(MIRStream));
PM.add(createFreeMachineFunctionPass());
PM.run(*M);
cl::ResetAllOptionOccurrences();`
![Screenshot_1](https://github.com/llvm/llvm-project/assets/20927731/e95c9d3c-48f6-4173-b0ed-cae635f1f1d1)
![Screenshot_2](https://github.com/llvm/llvm-project/assets/20927731/fcab5e1e-000e-48d2-844f-62d80123f22b)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysV01v47wR_jX0hbAhUZYtHXxw5PitgVU3SNK-x4AiRzJbilRJavd1D_3tBSn5M9rdFi0QxOLwmZlnPjiiqLWiUQAblD6hdDejvTtqszFR5CI7qzQ_bQ7YmRNuQIGhDjC1FtpKnjDTHHDVO_z9CAoLDH8A6x1g4TCjvQXcAgZjtMG0dmDO-4gUGKVPQmEmqWqwNlhKhoXFSpuWSnn1xbHV3lxLT7gC_E3YnkpsXc-Fxp3RlYQWJXuU7lC0Q9EWraLxb1hGuXUcJVuUbK0zQjX48IpRssOIEJQWCqXFgORQCwX4mxYco2XEhaW2RSRDJMdSMyo_eqVoC_yDcm4wIkmE0frpzgYoZ07e2a0QRTkiaRScOiokZlRKLFZLTG2LPSww8f9DWsJTskPrJ2M7tN4hUvwLrZ-4MLWkzVVQd9bcrCRtrF-OlgJvT3KCSxy4UM4DC0_Oe84ekVeyISk_Yfs_Uh1ZxD-ibMAFCvdyb4-g5GlY4oMSTlAp_glbKd-pacDZIQ0XDIryCVRZ_Aq3te2LEcqB-U-Q1Ngp4Aj_8uWvZaGVgz8cHn9vrb2VO0Ebpa0TDL-Vz_7sfDZyaeleiX_08NE5g5Ki1LyXgJJnXGoeStx5LodXRLISWm1OT31dg3mFGpHMiwt_CvwD8VxJcfFIigu5qSBGT2SLy-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