brintos

brintos / llvm-project-archived public Read only

0
0
Text · 988 B · bf9b1da Raw
33 lines · cpp
1// Check that the pointer adjustment from the virtual base offset is loaded as a2// 32-bit int.3 4// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -o - -emit-llvm | FileCheck %s5 6// CHECK-LABEL: @_ZTv0_n12_N7Derived1fEi(7// CHECK-NEXT:  entry:8// CHECK:        [[vtable:%.+]] = load ptr, ptr %this1, align 89// CHECK-NEXT:   [[vbase_offset_ptr:%.+]] = getelementptr inbounds i8, ptr [[vtable]], i64 -1210// CHECK-NEXT:   [[vbase_offset:%.+]] = load i32, ptr [[vbase_offset_ptr]], align 411// CHECK-NEXT:   [[adj_this:%.+]] = getelementptr inbounds i8, ptr %this1, i32 [[vbase_offset]]12// CHECK:        [[call:%.+]] = tail call noundef i32 @_ZN7Derived1fEi(ptr noundef{{[^,]*}} [[adj_this]], i32 noundef {{.*}})13// CHECK:        ret i32 [[call]]14 15class Base {16public:17  virtual int f(int x);18 19private:20  long x;21};22 23class Derived : public virtual Base {24public:25  virtual int f(int x);26 27private:28  long y;29};30 31int Base::f(int x) { return x + 1; }32int Derived::f(int x) { return x + 2; }33