swift icon indicating copy to clipboard operation
swift copied to clipboard

Enable usage of LLVM's opaque pointer

Open aschwaighofer opened this issue 1 year ago • 21 comments

This PR enables usage of LLVM's opaque pointer type ptr during LLVM IR code generation (instead of usage of typed pointers e.g. i64 *).

I have added a %use_no_opaque_pointers substitution for tests which will expand to the clang frontend flag (-Xcc -Xclang -Xcc -no-opaque-pointers) which disables opaque pointers.

Example usage:

%target-swift-frontend %use_no_opaque_pointers -emit-ir %s | %FileCheck %s

This substitution can be used to run tests under the -no-opaque-pointers option.

All LLVM IR checking tests are moved to use this option to keep them passing. An invocation without the %FileCheck command was added to verify that the test does not crash.

-// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir | %FileCheck %s
+// RUN: %target-swift-frontend %use_no_opaque_pointers -parse-stdlib %s -emit-ir | %FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir

This approach should facilitate incrementally moving the test to use opaque pointers.

rdar://108891584

aschwaighofer avatar May 23 '23 15:05 aschwaighofer

@swift-ci test

aschwaighofer avatar May 23 '23 15:05 aschwaighofer

We will need a newer version of Xcode, the version installed on the build has a libtool/ar binary that does not support opaque pointers in bitcode.

aschwaighofer avatar May 23 '23 17:05 aschwaighofer

@swift-ci test linux

aschwaighofer avatar May 23 '23 18:05 aschwaighofer

An invocation without the %FileCheck command was added to verify that the test does not crash.

Just to double check, as the tests are ported, should we also remove this line?

felipepiovezan avatar May 23 '23 18:05 felipepiovezan

An invocation without the %FileCheck command was added to verify that the test does not crash.

Just to double check, as the tests are ported, should we also remove this line?

@felipepiovezan Yes please.

aschwaighofer avatar May 23 '23 18:05 aschwaighofer

This PR will require Xcode 14.3 to pass all tests on macOS. This is due to the usage of bitcode files containing opaque pointers and tools in Xcode prior to 14.3 did not support opaque pointers.

aschwaighofer avatar May 23 '23 18:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 23 '23 19:05 aschwaighofer

@swift-ci test

aschwaighofer avatar May 23 '23 22:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 15:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 15:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 17:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 19:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 20:05 aschwaighofer

@swift-ci test windows

aschwaighofer avatar May 24 '23 22:05 aschwaighofer

@swift-ci test macos

aschwaighofer avatar May 24 '23 22:05 aschwaighofer

@swift-ci test linux

aschwaighofer avatar May 25 '23 14:05 aschwaighofer

@swift-ci test

aschwaighofer avatar May 25 '23 14:05 aschwaighofer

@swift-ci test

aschwaighofer avatar May 25 '23 19:05 aschwaighofer

@swift-ci test

aschwaighofer avatar May 26 '23 13:05 aschwaighofer

Please test with following PR: https://github.com/apple/llvm-project/pull/6923 @swift-ci test

aschwaighofer avatar May 26 '23 18:05 aschwaighofer

Please test with following PR: https://github.com/apple/llvm-project/pull/6923 @swift-ci test

aschwaighofer avatar Jun 08 '23 17:06 aschwaighofer

@swift-ci test

aschwaighofer avatar Jun 14 '23 17:06 aschwaighofer