Closed edwintorok closed 2 years ago
mentioned in issue llvm/llvm-bugzilla-archive#4064
This should fix it, I think:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090427/076811.html
does this patch fix it (and produce the correct suffix)? http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090119/072614.html
If not, please attach a .bc file produced with -emit-llvm, thanks.
I get an error from LLC now, bitcode below
llc: /home/edwin/llvm-bootstrap/llvm/include/llvm/Target/TargetRegisterInfo.h:255: static bool llvm::TargetRegisterInfo::isPhysicalRegister(unsigned int): Assertion `Reg && "this is not a register!"' failed. 0 llc 0x0000000000c6e29f 1 libc.so.6 0x00007f91fb3e0f60 2 libc.so.6 0x00007f91fb3e0ed5 gsignal + 53 3 libc.so.6 0x00007f91fb3e23f3 abort + 387 4 libc.so.6 0x00007f91fb3d9dc9 __assert_fail + 233 5 llc 0x000000000075df7f 6 llc 0x000000000075e91c 7 llc 0x0000000000a0bfaf llvm::AsmPrinter::printInlineAsm(llvm::MachineInstr const*) const + 1647 8 llc 0x000000000075eba1 9 llc 0x000000000075f884 10 llc 0x0000000000c09bfb llvm::FPPassManager::runOnFunction(llvm::Function&) + 347 11 llc 0x0000000000c09ff6 llvm::FunctionPassManagerImpl::run(llvm::Function&) + 134 12 llc 0x0000000000c0a17e llvm::FunctionPassManager::run(llvm::Function&) + 62 13 llc 0x00000000004fbbc1 main + 4193 14 libc.so.6 0x00007f91fb3cd1a6 __libc_start_main + 230 15 llc 0x00000000004fa0b9 std::ios_base::Init::~Init() + 57 Aborted
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" @boot_pat_state = internal global i64 0, section ".data.read_mostly" ; <i64> [#uses=1] @per_cpu__cpu_number = external global i32 ; <i32> [#uses=1] @.str = internal constant [50 x i8] c"<6>x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\0A\00" ; <[50 x i8]*> [#uses=1]
define void @pat_init() nounwind {
entry:
%ret = alloca i32 ; <i32> [#uses=2]
%pat = alloca i64 ; <i64> [#uses=1]
%0 = alloca i32 ; <i32> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ;
return: ; preds = %entry ret void }
declare i32 @printk(...)
does this patch fix it (and produce the correct suffix)? http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090119/072614.html
If not, please attach a .bc file produced with -emit-llvm, thanks.
Extended Description
Another one from the kernel
typedef unsigned long long u64; extern typeof(int) per_cpucpu_number; static u64 attribute((section(".data.read_mostly"))) boot_pat_state; void pat_init(void) { u64 pat; printk("<6>" "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n", (({ typeof(per_cpucpu_number) ret; switch (sizeof(per_cpu__cpu_number)) { case 4: asm("mov" "l ""%%""gs"":%P" "1"",%0" : "=r" (ret) : "m" (per_cpu__cpu_number)); } ret__; } )), boot_pat_state, pat); }
$ llvm-gcc testcase-min.i Invalid operand found in inline asm: 'movl %gs:${1:P},$0' INLINEASM <es:movl %gs:${1:P},$0>, 10, %ECX, 36, %reg0, 1, %reg0,
With %1 gcc generates this: movl %gs:per_cpu__cpu_number,%eax
Without %P gcc generates this: movl %gs:per_cpu__cpu_number(%rip),%eax