This patch is to fix an end-to-end bug (https://gcc.godbolt.org/z/GG44f6) on recent rewrite on back-end's RegAllocFast.cpp. I created a fix patch in back-end before (https://reviews.llvm.org/D93983). Both solutions are reasonable to me. The proof of this patch is that GNU inline ASM doesn't support setting one register as both "output" and "clobber"(Both clang and gcc enable this feature https://gcc.godbolt.org/z/4n6W56). Moreover, since MS inline ASM didn't define semantics of "output" or "clobber". So I think LLVM IR should follow this rule with GNU inline ASM, too.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2488 | ={eax} is set in X86_32TargetCodeGenInfo::addReturnRegisterOutputs, which also handles EAX:EDX case by =A. I think it's better handle it in the function to cover the other case as well. |
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2488 | THX for review. Agree. I'll update. |
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2493 | Should consider the Clobber == "edx"? |
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2490 | If Clobber is edx only, we shouldn't change "={eax}" to "=&{eax}". |
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2490 | Yes! I'll update and add a test. THX for review! |
LGTM.
clang/lib/CodeGen/CGStmt.cpp | ||
---|---|---|
2491 | I'm not sure if there's real case that there's "={edx}" for MS inline asm, but there's no problem we handle it here. |
clang-format not found in user's PATH; not linting file.