[PATCH] D142834: [X86][MC][bugfix] Report error for mismatched modifier in inline asm and remove function getX86SubSuperRegisterOrZero

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 23:56:10 PST 2023


skan added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp:748
   switch (Size) {
   default: return X86::NoRegister;
   case 8:
----------------
skan wrote:
> craig.topper wrote:
> > Why do we allow invalid sizes?
> I think the previous author was overly conservative here. Let's use a `llvm_unreachable` here.
> Why do we allow invalid sizes?

The test  `CodeGen/X86/asm-reject-reg-type-mismatch.ll` will fail if we use `llvm_unreachable` here.

```
; CHECK: error: couldn't allocate output register for constraint '{ax}'
define i128 @blup() {
  %v = tail call i128 asm "", "={ax},0"(i128 0)
  ret i128 %v
}
```

See more details here https://reviews.llvm.org/D10813 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142834/new/

https://reviews.llvm.org/D142834



More information about the llvm-commits mailing list