[clang] 0cab8d2 - Reapply [IR] Mark and/or constant expressions as undesirable
Author: Nikita Popov Date: 2023-07-25T15:31:45+02:00 New Revision: 0cab8d20417c0e2ccc1ffc5505e080126f5de8e6 URL: https://github.com/llvm/llvm-project/commit/0cab8d20417c0e2ccc1ffc5505e080126f5de8e6 DIFF: https://github.com/llvm/llvm-project/commit/0cab8d20417c0e2ccc1ffc5505e080126f5de8e6.diff LOG: Reapply [IR] Mark and/or constant expressions as undesirable This reapplies the change for and, but also marks or as undesirable at the same time. Only handling one of them can cause infinite combine loops due to the asymmetric handling. - In preparation for removing support for and/or expressions, mark them as undesirable. As such, we will no longer implicitly create such expressions, but they still exist. Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/and-xor-or.ll llvm/test/Transforms/InstCombine/and.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 551ccc4810bcd3..0e0a9b157464a6 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,7 +303,8 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -321,7 +322,8 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1200]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1)) @@ -390,7 +392,8 @@ char *allones_zero_OK(void) { char *allones_one_BAD(void) { // CHECK: define{{.*}} ptr @allones_one_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64
[clang] 086ee99 - Reapply [IR] Mark and constant expressions as undesirable
Author: Nikita Popov Date: 2023-07-21T10:10:50+02:00 New Revision: 086ee99564afbb11449c08ea2e094f7f49fadde5 URL: https://github.com/llvm/llvm-project/commit/086ee99564afbb11449c08ea2e094f7f49fadde5 DIFF: https://github.com/llvm/llvm-project/commit/086ee99564afbb11449c08ea2e094f7f49fadde5.diff LOG: Reapply [IR] Mark and constant expressions as undesirable Reapply after fixing an issue in canonicalizeLogicFirst() exposed by this change (218f97578b26f7a89f7f8ed0748c31ef0181f80a). - In preparation for removing support for and expressions, mark them as undesirable. As such, we will no longer implicitly create such expressions, but they still exist. Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/and-xor-or.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 551ccc4810bcd3..0e0a9b157464a6 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,7 +303,8 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -321,7 +322,8 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1200]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1)) @@ -390,7 +392,8 @@ char *allones_zero_OK(void) { char *allones_one_BAD(void) { // CHECK: define{{.*}} ptr @allones_one_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 -1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr
[clang] 9dc391e - Revert "[IR] Mark add constant expressions as undesirable"
Author: Nikita Popov Date: 2023-07-20T18:09:17+02:00 New Revision: 9dc391e89c7984394e352ea1cbf948b4bbdcd8a8 URL: https://github.com/llvm/llvm-project/commit/9dc391e89c7984394e352ea1cbf948b4bbdcd8a8 DIFF: https://github.com/llvm/llvm-project/commit/9dc391e89c7984394e352ea1cbf948b4bbdcd8a8.diff LOG: Revert "[IR] Mark add constant expressions as undesirable" This reverts commit f8a36d8c3e264c4fccf8058e699201a452ea7bb7. I believe this is causing an assertion failure on the sanitizer-x86_64-linux buildbot: clang++: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::BinaryOperator, From = llvm::Value]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed. #10 0x55bdd7e82408 canonicalizeLogicFirst(llvm::BinaryOperator&, llvm::IRBuilder&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2131:5 #11 0x55bdd7e80183 llvm::InstCombinerImpl::visitAnd(llvm::BinaryOperator&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2661:20 Likely the code is encountering a constant expression in a case it didn't before. Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 0e0a9b157464a6..551ccc4810bcd3 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,8 +303,7 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -322,8 +321,7 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void
[clang] 9dc391e - Revert "[IR] Mark add constant expressions as undesirable"
Author: Nikita Popov Date: 2023-07-20T18:09:17+02:00 New Revision: 9dc391e89c7984394e352ea1cbf948b4bbdcd8a8 URL: https://github.com/llvm/llvm-project/commit/9dc391e89c7984394e352ea1cbf948b4bbdcd8a8 DIFF: https://github.com/llvm/llvm-project/commit/9dc391e89c7984394e352ea1cbf948b4bbdcd8a8.diff LOG: Revert "[IR] Mark add constant expressions as undesirable" This reverts commit f8a36d8c3e264c4fccf8058e699201a452ea7bb7. I believe this is causing an assertion failure on the sanitizer-x86_64-linux buildbot: clang++: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::BinaryOperator, From = llvm::Value]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed. #10 0x55bdd7e82408 canonicalizeLogicFirst(llvm::BinaryOperator&, llvm::IRBuilder&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2131:5 #11 0x55bdd7e80183 llvm::InstCombinerImpl::visitAnd(llvm::BinaryOperator&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2661:20 Likely the code is encountering a constant expression in a case it didn't before. Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 0e0a9b157464a6..551ccc4810bcd3 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,8 +303,7 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -322,8 +321,7 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize - // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void
[clang] f8a36d8 - [IR] Mark add constant expressions as undesirable
Author: Nikita Popov Date: 2023-07-20T15:24:19+02:00 New Revision: f8a36d8c3e264c4fccf8058e699201a452ea7bb7 URL: https://github.com/llvm/llvm-project/commit/f8a36d8c3e264c4fccf8058e699201a452ea7bb7 DIFF: https://github.com/llvm/llvm-project/commit/f8a36d8c3e264c4fccf8058e699201a452ea7bb7.diff LOG: [IR] Mark add constant expressions as undesirable In preparation for removing support for add expressions, mark them as undesirable. As such, we will no longer implicitly create such expressions, but they still exist. Added: Modified: clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/test/CodeGen/Hexagon/atomic-opaque-basic.ll llvm/test/Transforms/InstCombine/bswap-fold.ll llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c index 551ccc4810bcd3..0e0a9b157464a6 100644 --- a/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c +++ b/clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c @@ -303,7 +303,8 @@ char *one_zero(void) { char *one_one_OK(void) { // CHECK: define{{.*}} ptr @one_one_OK() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1100]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 1) to i64), i64 1), i64 1)) @@ -321,7 +322,8 @@ char *one_one_OK(void) { char *one_allones_BAD(void) { // CHECK: define{{.*}} ptr @one_allones_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT: %[[AND:.*]] = and i1 icmp ne (ptr inttoptr (i64 1 to ptr), ptr null), icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0), !nosanitize + // CHECK-SANITIZE-C-NEXT: br i1 %[[AND]], label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE-CPP-NEXT: br i1 xor (i1 icmp eq (ptr inttoptr (i64 1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize // CHECK-SANITIZE: [[HANDLER_POINTER_OVERFLOW]]: // CHECK-SANITIZE-NORECOVER-NEXT: call void @__ubsan_handle_pointer_overflow_abort(ptr @[[LINE_1200]], i64 1, i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 1 to ptr), i64 -1) to i64), i64 1), i64 1)) @@ -390,7 +392,8 @@ char *allones_zero_OK(void) { char *allones_one_BAD(void) { // CHECK: define{{.*}} ptr @allones_one_BAD() // CHECK-NEXT: [[ENTRY:.*]]: - // CHECK-SANITIZE-C-NEXT: br i1 and (i1 icmp ne (ptr inttoptr (i64 -1 to ptr), ptr null), i1 icmp ne (i64 add (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr inttoptr (i64 -1 to ptr), i64 1) to i64), i64 -1), i64 -1), i64 0)), label %[[CONT:.*]], label %[[HANDLER_POINTER_OVERFLOW:[^,]+]],{{.*}} !nosanitize + // CHECK-SANITIZE-C-NEXT:
[clang] 61e0822 - [llvm][clang] Remove uses of isOpaquePointerTy() (NFC)
Author: Nikita Popov Date: 2023-07-14T10:27:58+02:00 New Revision: 61e0822efab14dd922f9c3ee479a0a51952526d9 URL: https://github.com/llvm/llvm-project/commit/61e0822efab14dd922f9c3ee479a0a51952526d9 DIFF: https://github.com/llvm/llvm-project/commit/61e0822efab14dd922f9c3ee479a0a51952526d9.diff LOG: [llvm][clang] Remove uses of isOpaquePointerTy() (NFC) This now always returns true (for pointer types). Added: Modified: clang/lib/CodeGen/CGCall.h llvm/lib/Analysis/InstructionSimplify.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/FuzzMutate/Operations.cpp llvm/lib/FuzzMutate/RandomIRBuilder.cpp llvm/lib/IR/Core.cpp llvm/lib/Transforms/Coroutines/Coroutines.cpp llvm/lib/Transforms/Scalar/GVN.cpp llvm/lib/Transforms/Scalar/SROA.cpp llvm/tools/llvm-stress/llvm-stress.cpp Removed: diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index 824f0a9a882990..eaaf10c4eec687 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -109,9 +109,6 @@ class CGCallee { AbstractInfo = abstractInfo; assert(functionPtr && "configuring callee without function pointer"); assert(functionPtr->getType()->isPointerTy()); -assert(functionPtr->getType()->isOpaquePointerTy() || - functionPtr->getType()->getNonOpaquePointerElementType() - ->isFunctionTy()); } static CGCallee forBuiltin(unsigned builtinID, diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 038268d0705f85..6cc919afa0285f 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4888,10 +4888,8 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr, } } - // For opaque pointers an all-zero GEP is a no-op. For typed pointers, - // it may be equivalent to a bitcast. - if (Ptr->getType()->getScalarType()->isOpaquePointerTy() && - Ptr->getType() == GEPTy && + // All-zero GEP is a no-op, unless it performs a vector splat. + if (Ptr->getType() == GEPTy && all_of(Indices, [](const auto *V) { return match(V, m_Zero()); })) return Ptr; diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index dcb3476a2d840a..ed9e1d6ebfa210 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2675,7 +2675,7 @@ bool LLParser::parseType(Type *, const Twine , bool AllowVoid) { // Handle "ptr" opaque pointer type. // // Type ::= ptr ('addrspace' '(' uint32 ')')? -if (Result->isOpaquePointerTy()) { +if (Result->isPointerTy()) { unsigned AddrSpace; if (parseOptionalAddrSpace(AddrSpace)) return true; diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index c31f2afadc516f..4095545240ca11 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1381,17 +1381,6 @@ unsigned BitcodeReader::getVirtualTypeID(Type *Ty, return It->second; } -#ifndef NDEBUG - if (!Ty->isOpaquePointerTy()) { -assert(Ty->getNumContainedTypes() == ChildTypeIDs.size() && - "Wrong number of contained types"); -for (auto Pair : zip(Ty->subtypes(), ChildTypeIDs)) { - assert(std::get<0>(Pair) == getTypeByID(std::get<1>(Pair)) && - "Incorrect contained type ID"); -} - } -#endif - unsigned TypeID = TypeList.size(); TypeList.push_back(Ty); if (!ChildTypeIDs.empty()) diff --git a/llvm/lib/FuzzMutate/Operations.cpp b/llvm/lib/FuzzMutate/Operations.cpp index 48455c781629f2..408f35879acd3b 100644 --- a/llvm/lib/FuzzMutate/Operations.cpp +++ b/llvm/lib/FuzzMutate/Operations.cpp @@ -196,9 +196,7 @@ OpDescriptor llvm::fuzzerop::gepDescriptor(unsigned Weight) { auto buildGEP = [](ArrayRef Srcs, Instruction *Inst) { // TODO: It would be better to generate a random type here, rather than // generating a random value and picking its type. -Type *Ty = Srcs[0]->getType()->isOpaquePointerTy() - ? Srcs[1]->getType() - : Srcs[0]->getType()->getNonOpaquePointerElementType(); +Type *Ty = Srcs[1]->getType(); auto Indices = ArrayRef(Srcs).drop_front(2); return GetElementPtrInst::Create(Ty, Srcs[0], Indices, "G", Inst); }; diff --git a/llvm/lib/FuzzMutate/RandomIRBuilder.cpp b/llvm/lib/FuzzMutate/RandomIRBuilder.cpp index bbacfedf456d37..548ba7956fd5a1 100644 --- a/llvm/lib/FuzzMutate/RandomIRBuilder.cpp +++ b/llvm/lib/FuzzMutate/RandomIRBuilder.cpp @@ -211,10 +211,8 @@ Value *RandomIRBuilder::newSource(BasicBlock , ArrayRef Insts, IP = ++I->getIterator(); assert(IP != BB.end() && "guaranteed by the findPointer"); } -// For opaque pointers, pick the type independently. -Type *AccessTy
[clang] e98cbb9 - [CodeGenCXX] Add test for forward declare as array elem (NFC)
Author: Nikita Popov Date: 2023-07-13T14:26:25+02:00 New Revision: e98cbb95b8b96d3908a808bbcd639680a5197428 URL: https://github.com/llvm/llvm-project/commit/e98cbb95b8b96d3908a808bbcd639680a5197428 DIFF: https://github.com/llvm/llvm-project/commit/e98cbb95b8b96d3908a808bbcd639680a5197428.diff LOG: [CodeGenCXX] Add test for forward declare as array elem (NFC) To guard against the miscompile that D153142 would have introduced. Added: clang/test/CodeGenCXX/forward-declare-as-array-elem.cpp Modified: Removed: diff --git a/clang/test/CodeGenCXX/forward-declare-as-array-elem.cpp b/clang/test/CodeGenCXX/forward-declare-as-array-elem.cpp new file mode 100644 index 00..0d76e32b44cb27 --- /dev/null +++ b/clang/test/CodeGenCXX/forward-declare-as-array-elem.cpp @@ -0,0 +1,20 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s + +struct S; +extern S a[10]; +S(*b)[10] = +struct S { + int x; +}; + +// The address calculation should be based on the size of the struct S +// declaration, not a dummy type like i8. + +// CHECK-LABEL: define dso_local noundef i32 @_Z1fv +// CHECK-SAME: () #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr getelementptr inbounds ([10 x %struct.S], ptr @a, i64 0, i64 3), align 4 +// CHECK-NEXT:ret i32 [[TMP0]] +// +int f() { return a[3].x; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2903a8a - [CGTypes] Remove recursion protection
Author: Nikita Popov Date: 2023-06-16T13:07:14+02:00 New Revision: 2903a8ab07260f9836db82b7e5330f1892830aca URL: https://github.com/llvm/llvm-project/commit/2903a8ab07260f9836db82b7e5330f1892830aca DIFF: https://github.com/llvm/llvm-project/commit/2903a8ab07260f9836db82b7e5330f1892830aca.diff LOG: [CGTypes] Remove recursion protection With opaque pointers, it should no longer be necessary to protect against recursion when converting Clang types to LLVM types, as recursion can only be introduced via pointer types. Differential Revision: https://reviews.llvm.org/D152999 Added: Modified: clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/CodeGenTypes.h Removed: diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index e4836c850a157..30021794a0bb3 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -125,93 +125,9 @@ bool CodeGenTypes::isRecordLayoutComplete(const Type *Ty) const { return I != RecordDeclTypes.end() && !I->second->isOpaque(); } -static bool -isSafeToConvert(QualType T, CodeGenTypes , -llvm::SmallPtrSet ); - - -/// isSafeToConvert - Return true if it is safe to convert the specified record -/// decl to IR and lay it out, false if doing so would cause us to get into a -/// recursive compilation mess. -static bool -isSafeToConvert(const RecordDecl *RD, CodeGenTypes , -llvm::SmallPtrSet ) { - // If we have already checked this type (maybe the same type is used by-value - // multiple times in multiple structure fields, don't check again. - if (!AlreadyChecked.insert(RD).second) -return true; - - const Type *Key = CGT.getContext().getTagDeclType(RD).getTypePtr(); - - // If this type is already laid out, converting it is a noop. - if (CGT.isRecordLayoutComplete(Key)) return true; - - // If this type is currently being laid out, we can't recursively compile it. - if (CGT.isRecordBeingLaidOut(Key)) -return false; - - // If this type would require laying out bases that are currently being laid - // out, don't do it. This includes virtual base classes which get laid out - // when a class is translated, even though they aren't embedded by-value into - // the class. - if (const CXXRecordDecl *CRD = dyn_cast(RD)) { -for (const auto : CRD->bases()) - if (!isSafeToConvert(I.getType()->castAs()->getDecl(), CGT, - AlreadyChecked)) -return false; - } - - // If this type would require laying out members that are currently being laid - // out, don't do it. - for (const auto *I : RD->fields()) -if (!isSafeToConvert(I->getType(), CGT, AlreadyChecked)) - return false; - - // If there are no problems, lets do it. - return true; -} - -/// isSafeToConvert - Return true if it is safe to convert this field type, -/// which requires the structure elements contained by-value to all be -/// recursively safe to convert. -static bool -isSafeToConvert(QualType T, CodeGenTypes , -llvm::SmallPtrSet ) { - // Strip off atomic type sugar. - if (const auto *AT = T->getAs()) -T = AT->getValueType(); - - // If this is a record, check it. - if (const auto *RT = T->getAs()) -return isSafeToConvert(RT->getDecl(), CGT, AlreadyChecked); - - // If this is an array, check the elements, which are embedded inline. - if (const auto *AT = CGT.getContext().getAsArrayType(T)) -return isSafeToConvert(AT->getElementType(), CGT, AlreadyChecked); - - // Otherwise, there is no concern about transforming this. We only care about - // things that are contained by-value in a structure that can have another - // structure as a member. - return true; -} - - -/// isSafeToConvert - Return true if it is safe to convert the specified record -/// decl to IR and lay it out, false if doing so would cause us to get into a -/// recursive compilation mess. -static bool isSafeToConvert(const RecordDecl *RD, CodeGenTypes ) { - // If no structs are being laid out, we can certainly do this one. - if (CGT.noRecordsBeingLaidOut()) return true; - - llvm::SmallPtrSet AlreadyChecked; - return isSafeToConvert(RD, CGT, AlreadyChecked); -} - /// isFuncParamTypeConvertible - Return true if the specified type in a /// function parameter or result position can be converted to an IR type at this -/// point. This boils down to being whether it is complete, as well as whether -/// we've temporarily deferred expanding the type because we're in a recursive -/// context. +/// point. This boils down to being whether it is complete. bool CodeGenTypes::isFuncParamTypeConvertible(QualType Ty) { // Some ABIs cannot have their member pointers represented in IR unless // certain circumstances have been reached. @@ -223,21 +139,7 @@ bool CodeGenTypes::isFuncParamTypeConvertible(QualType Ty) { if (!TT) return true; // Incomplete
[clang] 835cdcb - [Clang] Fix compare-record.c test on s390x (NFC)
Author: Nikita Popov Date: 2023-06-16T12:43:58+02:00 New Revision: 835cdcb9191fb8036f782ae532594c4e1f456ffc URL: https://github.com/llvm/llvm-project/commit/835cdcb9191fb8036f782ae532594c4e1f456ffc DIFF: https://github.com/llvm/llvm-project/commit/835cdcb9191fb8036f782ae532594c4e1f456ffc.diff LOG: [Clang] Fix compare-record.c test on s390x (NFC) s390x looks through pointers when determining the "externally visible vector ABI". For that reason, the test shows different behavior just on that platform. Adjust the test in the reverse direction of what I originall did: Make sure that the type behind the pointer is always queried, by dereferencing the pointer. Added: Modified: clang/test/Modules/compare-record.c Removed: diff --git a/clang/test/Modules/compare-record.c b/clang/test/Modules/compare-record.c index c5ce285aa77ee..60998696969e1 100644 --- a/clang/test/Modules/compare-record.c +++ b/clang/test/Modules/compare-record.c @@ -423,10 +423,13 @@ struct CompareDifferentFieldInIndirectStruct compareIndirectStruct; // expected-error@second-nested-struct.h:* {{'IndirectStruct::mismatchingField' from module 'Second' is not present in definition of 'struct IndirectStruct' in module 'First.Hidden'}} // expected-note@first-nested-struct.h:* {{declaration of 'mismatchingField' does not match}} #elif defined(CASE3) -// This currently doesn't produce an error, because there is no dependency -// on the layout of DirectStruct. -// expected-no-diagnostics +// expected-error@second-nested-struct.h:* {{'IndirectStruct::mismatchingField' from module 'Second' is not present in definition of 'struct IndirectStruct' in module 'First.Hidden'}} +// expected-note@first-nested-struct.h:* {{declaration of 'mismatchingField' does not match}} struct CompareIndirectStructPointer compareIndirectStructPointer; +struct DirectStruct test() { + // Make sure the type behind the pointer is inspected. + return *compareIndirectStructPointer.directFieldPointer; +} #endif //--- include/first-anonymous.h ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b92ccc3 - [CGCall] Directly create opaque pointers (NFCI)
Author: Nikita Popov Date: 2023-06-15T10:06:40+02:00 New Revision: b92ccc355acb8a329918ceb2837df1b351675ece URL: https://github.com/llvm/llvm-project/commit/b92ccc355acb8a329918ceb2837df1b351675ece DIFF: https://github.com/llvm/llvm-project/commit/b92ccc355acb8a329918ceb2837df1b351675ece.diff LOG: [CGCall] Directly create opaque pointers (NFCI) Added: Modified: clang/lib/CodeGen/CGCall.cpp Removed: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 8bb8e2bb3969e..71268d9abcbda 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1637,9 +1637,8 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo ) { if (retAI.getInAllocaSRet()) { // sret things on win32 aren't void, they return the sret pointer. QualType ret = FI.getReturnType(); - llvm::Type *ty = ConvertType(ret); unsigned addressSpace = CGM.getTypes().getTargetAddressSpace(ret); - resultType = llvm::PointerType::get(ty, addressSpace); + resultType = llvm::PointerType::get(getLLVMContext(), addressSpace); } else { resultType = llvm::Type::getVoidTy(getLLVMContext()); } @@ -1661,17 +1660,17 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo ) { // Add type for sret argument. if (IRFunctionArgs.hasSRetArg()) { QualType Ret = FI.getReturnType(); -llvm::Type *Ty = ConvertType(Ret); unsigned AddressSpace = CGM.getTypes().getTargetAddressSpace(Ret); ArgTypes[IRFunctionArgs.getSRetArgNo()] = -llvm::PointerType::get(Ty, AddressSpace); +llvm::PointerType::get(getLLVMContext(), AddressSpace); } // Add type for inalloca argument. if (IRFunctionArgs.hasInallocaArg()) { auto ArgStruct = FI.getArgStruct(); assert(ArgStruct); -ArgTypes[IRFunctionArgs.getInallocaArgNo()] = ArgStruct->getPointerTo(); +ArgTypes[IRFunctionArgs.getInallocaArgNo()] = +llvm::PointerType::getUnqual(getLLVMContext()); } // Add in all of the required arguments. @@ -1695,20 +1694,17 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo ) { assert(NumIRArgs == 0); break; -case ABIArgInfo::Indirect: { +case ABIArgInfo::Indirect: assert(NumIRArgs == 1); // indirect arguments are always on the stack, which is alloca addr space. - llvm::Type *LTy = ConvertTypeForMem(it->type); - ArgTypes[FirstIRArg] = LTy->getPointerTo( - CGM.getDataLayout().getAllocaAddrSpace()); + ArgTypes[FirstIRArg] = llvm::PointerType::get( + getLLVMContext(), CGM.getDataLayout().getAllocaAddrSpace()); break; -} -case ABIArgInfo::IndirectAliased: { +case ABIArgInfo::IndirectAliased: assert(NumIRArgs == 1); - llvm::Type *LTy = ConvertTypeForMem(it->type); - ArgTypes[FirstIRArg] = LTy->getPointerTo(ArgInfo.getIndirectAddrSpace()); + ArgTypes[FirstIRArg] = llvm::PointerType::get( + getLLVMContext(), ArgInfo.getIndirectAddrSpace()); break; -} case ABIArgInfo::Extend: case ABIArgInfo::Direct: { // Fast-isel and the optimizer generally like scalar values better than @@ -2861,13 +2857,10 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo , // If we're using inalloca, all the memory arguments are GEPs off of the last // parameter, which is a pointer to the complete memory area. Address ArgStruct = Address::invalid(); - if (IRFunctionArgs.hasInallocaArg()) { + if (IRFunctionArgs.hasInallocaArg()) ArgStruct = Address(Fn->getArg(IRFunctionArgs.getInallocaArgNo()), FI.getArgStruct(), FI.getArgStructAlignment()); -assert(ArgStruct.getType() == FI.getArgStruct()->getPointerTo()); - } - // Name the struct return parameter. if (IRFunctionArgs.hasSRetArg()) { auto AI = Fn->getArg(IRFunctionArgs.getSRetArgNo()); @@ -3933,8 +3926,8 @@ static AggValueSlot createPlaceholderSlot(CodeGenFunction , // FIXME: Generate IR in one pass, rather than going back and fixing up these // placeholders. llvm::Type *IRTy = CGF.ConvertTypeForMem(Ty); - llvm::Type *IRPtrTy = IRTy->getPointerTo(); - llvm::Value *Placeholder = llvm::PoisonValue::get(IRPtrTy->getPointerTo()); + llvm::Type *IRPtrTy = llvm::PointerType::getUnqual(CGF.getLLVMContext()); + llvm::Value *Placeholder = llvm::PoisonValue::get(IRPtrTy); // FIXME: When we generate this IR in one pass, we shouldn't need // this win32-specific alignment hack. @@ -5331,35 +5324,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo , // If we're using inalloca, set up that argument. if (ArgMemory.isValid()) { llvm::Value *Arg = ArgMemory.getPointer(); -if (CallInfo.isVariadic()) { - // When passing non-POD arguments by value to variadic functions, we will - // end up with a variadic prototype and an inalloca call site. In such -
[clang] 09d6ee7 - [Clang] Directly create opaque pointers
Author: Nikita Popov Date: 2023-06-15T09:09:33+02:00 New Revision: 09d6ee765780837d5156ac81f968465bdcec73ba URL: https://github.com/llvm/llvm-project/commit/09d6ee765780837d5156ac81f968465bdcec73ba DIFF: https://github.com/llvm/llvm-project/commit/09d6ee765780837d5156ac81f968465bdcec73ba.diff LOG: [Clang] Directly create opaque pointers In CGTypes, directly create opaque pointers, without computing the LLVM element type. This is not as straightforward as I though it would be, because apparently computing the LLVM type also causes a number of side effects. In particular, we no longer produce diagnostics like -Wpacked for typed (only) behind pointers, because we no longer depend on their layout. Differential Revision: https://reviews.llvm.org/D152505 Added: Modified: clang/lib/CodeGen/CodeGenTypes.cpp clang/test/CodeGenCXX/matrix-type-builtins.cpp clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp clang/test/Modules/compare-record.c clang/test/PCH/headersearch.cpp clang/test/Sema/ms_class_layout.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 0ceab41cdd360..e4836c850a157 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -675,19 +675,15 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { case Type::RValueReference: { const ReferenceType *RTy = cast(Ty); QualType ETy = RTy->getPointeeType(); -llvm::Type *PointeeType = ConvertTypeForMem(ETy); unsigned AS = getTargetAddressSpace(ETy); -ResultType = llvm::PointerType::get(PointeeType, AS); +ResultType = llvm::PointerType::get(getLLVMContext(), AS); break; } case Type::Pointer: { const PointerType *PTy = cast(Ty); QualType ETy = PTy->getPointeeType(); -llvm::Type *PointeeType = ConvertTypeForMem(ETy); -if (PointeeType->isVoidTy()) - PointeeType = llvm::Type::getInt8Ty(getLLVMContext()); unsigned AS = getTargetAddressSpace(ETy); -ResultType = llvm::PointerType::get(PointeeType, AS); +ResultType = llvm::PointerType::get(getLLVMContext(), AS); break; } @@ -764,15 +760,9 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { break; } - case Type::ObjCObjectPointer: { -// Protocol qualifications do not influence the LLVM type, we just return a -// pointer to the underlying interface type. We don't need to worry about -// recursive conversion. -llvm::Type *T = - ConvertTypeForMem(cast(Ty)->getPointeeType()); -ResultType = T->getPointerTo(); + case Type::ObjCObjectPointer: +ResultType = llvm::PointerType::getUnqual(getLLVMContext()); break; - } case Type::Enum: { const EnumDecl *ED = cast(Ty)->getDecl(); @@ -786,18 +776,15 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { } case Type::BlockPointer: { -const QualType FTy = cast(Ty)->getPointeeType(); -llvm::Type *PointeeType = CGM.getLangOpts().OpenCL - ? CGM.getGenericBlockLiteralType() - : ConvertTypeForMem(FTy); // Block pointers lower to function type. For function type, // getTargetAddressSpace() returns default address space for // function pointer i.e. program address space. Therefore, for block // pointers, it is important to pass the pointee AST address space when // calling getTargetAddressSpace(), to ensure that we get the LLVM IR // address space for data pointers and not function pointers. +const QualType FTy = cast(Ty)->getPointeeType(); unsigned AS = Context.getTargetAddressSpace(FTy.getAddressSpace()); -ResultType = llvm::PointerType::get(PointeeType, AS); +ResultType = llvm::PointerType::get(getLLVMContext(), AS); break; } diff --git a/clang/test/CodeGenCXX/matrix-type-builtins.cpp b/clang/test/CodeGenCXX/matrix-type-builtins.cpp index 24bf797ab94a0..732fe1a18db3b 100644 --- a/clang/test/CodeGenCXX/matrix-type-builtins.cpp +++ b/clang/test/CodeGenCXX/matrix-type-builtins.cpp @@ -31,20 +31,20 @@ void test_transpose_template1() { void test_transpose_template2(MyMatrix ) { // CHECK-LABEL: define{{.*}} void @_Z24test_transpose_template2R8MyMatrixIdLj7ELj6EE( - // CHECK: call void @_Z9transposeIdLj7ELj6EE8MyMatrixIT_XT1_EXT0_EERKS0_IS1_XT0_EXT1_EE(ptr sret(%struct.MyMatrix.2) align 8 %ref.tmp1, ptr noundef nonnull align 8 dereferenceable(336) %0) - // CHECK-NEXT:call void @_Z9transposeIdLj6ELj7EE8MyMatrixIT_XT1_EXT0_EERKS0_IS1_XT0_EXT1_EE(ptr sret(%struct.MyMatrix.1) align 8 %ref.tmp, ptr noundef nonnull align 8 dereferenceable(336) %ref.tmp1) - // CHECK-NEXT:call void @_Z9transposeIdLj7ELj6EE8MyMatrixIT_XT1_EXT0_EERKS0_IS1_XT0_EXT1_EE(ptr sret(%struct.MyMatrix.2) align 8 %M2_t, ptr noundef nonnull align 8 dereferenceable(336) %ref.tmp) + //
[clang] 0211a75 - [Clang] Rename getElementBitCast() -> withElementType() (NFC)
Author: Nikita Popov Date: 2023-06-14T09:58:52+02:00 New Revision: 0211a75ed8b80848af7c87d2f925467448ae4f34 URL: https://github.com/llvm/llvm-project/commit/0211a75ed8b80848af7c87d2f925467448ae4f34 DIFF: https://github.com/llvm/llvm-project/commit/0211a75ed8b80848af7c87d2f925467448ae4f34.diff LOG: [Clang] Rename getElementBitCast() -> withElementType() (NFC) This no longer creates a bitcast, just changes the element type of the ConstantAddress. Added: Modified: clang/lib/CodeGen/Address.h clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/CodeGen/CGExprConstant.cpp Removed: diff --git a/clang/lib/CodeGen/Address.h b/clang/lib/CodeGen/Address.h index e020d95344ade..899aceac88672 100644 --- a/clang/lib/CodeGen/Address.h +++ b/clang/lib/CodeGen/Address.h @@ -127,10 +127,8 @@ class ConstantAddress : public Address { return llvm::cast(Address::getPointer()); } - ConstantAddress getElementBitCast(llvm::Type *ElemTy) const { -llvm::Constant *BitCast = llvm::ConstantExpr::getBitCast( -getPointer(), ElemTy->getPointerTo(getAddressSpace())); -return ConstantAddress(BitCast, ElemTy, getAlignment()); + ConstantAddress withElementType(llvm::Type *ElemTy) const { +return ConstantAddress(getPointer(), ElemTy, getAlignment()); } static bool isaImpl(Address addr) { diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index bf5013e521097..9c63e154ebebd 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -137,7 +137,7 @@ static void EmitDeclDestroy(CodeGenFunction , const VarDecl , } // Otherwise, the standard logic requires a helper function. } else { -Addr = Addr.getElementBitCast(CGF.ConvertTypeForMem(Type)); +Addr = Addr.withElementType(CGF.ConvertTypeForMem(Type)); Func = CodeGenFunction(CGM) .generateDestroyHelper(Addr, Type, CGF.getDestroyer(DtorKind), CGF.needsEHCleanup(DtorKind), ); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b0dd598715840..5bd42d9337506 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1987,7 +1987,7 @@ static ConstantLValue emitConstantObjCStringLiteral(const StringLiteral *S, QualType T, CodeGenModule ) { auto C = CGM.getObjCRuntime().GenerateConstantString(S); - return C.getElementBitCast(CGM.getTypes().ConvertTypeForMem(T)); + return C.withElementType(CGM.getTypes().ConvertTypeForMem(T)); } ConstantLValue ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8a19af5 - [Clang] Remove uses of PointerType::getWithSamePointeeType (NFC)
Author: Nikita Popov Date: 2023-06-12T12:18:28+02:00 New Revision: 8a19af513d549c173b5919fe697828c84cecc396 URL: https://github.com/llvm/llvm-project/commit/8a19af513d549c173b5919fe697828c84cecc396 DIFF: https://github.com/llvm/llvm-project/commit/8a19af513d549c173b5919fe697828c84cecc396.diff LOG: [Clang] Remove uses of PointerType::getWithSamePointeeType (NFC) No longer relevant with opaque pointers. Added: Modified: clang/lib/CodeGen/CGAtomic.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGClass.cpp clang/lib/CodeGen/CGDeclCXX.cpp clang/lib/CodeGen/CGOpenMPRuntime.cpp clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/CodeGen/TargetInfo.cpp Removed: diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp index e2d23a7252613..95f943d4bd67f 100644 --- a/clang/lib/CodeGen/CGAtomic.cpp +++ b/clang/lib/CodeGen/CGAtomic.cpp @@ -1097,8 +1097,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) { if (AS == LangAS::opencl_generic) return V; auto DestAS = getContext().getTargetAddressSpace(LangAS::opencl_generic); - auto T = llvm::cast(V->getType()); - auto *DestType = llvm::PointerType::getWithSamePointeeType(T, DestAS); + auto *DestType = llvm::PointerType::get(getLLVMContext(), DestAS); return getTargetHooks().performAddrSpaceCast( *this, V, AS, LangAS::opencl_generic, DestType, false); diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d39131828c066..8bb8e2bb3969e 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -5130,9 +5130,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo , I->copyInto(*this, AI); } else { // Skip the extra memcpy call. - auto *T = llvm::PointerType::getWithSamePointeeType( - cast(V->getType()), - CGM.getDataLayout().getAllocaAddrSpace()); + auto *T = llvm::PointerType::get( + CGM.getLLVMContext(), CGM.getDataLayout().getAllocaAddrSpace()); llvm::Value *Val = getTargetHooks().performAddrSpaceCast( *this, V, LangAS::Default, CGM.getASTAllocaAddressSpace(), T, diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 3238c31d2451f..8a71289270e28 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2132,8 +2132,8 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D, if (SlotAS != ThisAS) { unsigned TargetThisAS = getContext().getTargetAddressSpace(ThisAS); -llvm::Type *NewType = llvm::PointerType::getWithSamePointeeType( -This.getType(), TargetThisAS); +llvm::Type *NewType = +llvm::PointerType::get(getLLVMContext(), TargetThisAS); ThisPtr = getTargetHooks().performAddrSpaceCast(*this, This.getPointer(), ThisAS, SlotAS, NewType); } diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 04e42153519ae..bf5013e521097 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -199,8 +199,8 @@ void CodeGenFunction::EmitCXXGlobalVarDeclInit(const VarDecl , unsigned ActualAddrSpace = GV->getAddressSpace(); llvm::Constant *DeclPtr = GV; if (ActualAddrSpace != ExpectedAddrSpace) { -llvm::PointerType *PTy = llvm::PointerType::getWithSamePointeeType( -GV->getType(), ExpectedAddrSpace); +llvm::PointerType *PTy = +llvm::PointerType::get(getLLVMContext(), ExpectedAddrSpace); DeclPtr = llvm::ConstantExpr::getAddrSpaceCast(DeclPtr, PTy); } diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index a5a5ed1c98ae0..099c706e84ab2 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1918,8 +1918,7 @@ bool CGOpenMPRuntime::emitDeclareTargetVarDefinition(const VarDecl *VD, llvm::Constant *AddrInAS0 = Addr; if (Addr->getAddressSpace() != 0) AddrInAS0 = llvm::ConstantExpr::getAddrSpaceCast( -Addr, llvm::PointerType::getWithSamePointeeType( - cast(Addr->getType()), 0)); +Addr, llvm::PointerType::get(CGM.getLLVMContext(), 0)); CtorCGF.EmitAnyExprToMem(Init, Address(AddrInAS0, Addr->getValueType(), CGM.getContext().getDeclAlign(VD)), @@ -1969,8 +1968,7 @@ bool CGOpenMPRuntime::emitDeclareTargetVarDefinition(const VarDecl *VD, llvm::Constant *AddrInAS0 = Addr; if (Addr->getAddressSpace() != 0) AddrInAS0 = llvm::ConstantExpr::getAddrSpaceCast( -Addr, llvm::PointerType::getWithSamePointeeType( - cast(Addr->getType()),
[clang] 2c44168 - [Clang] Remove typed pointer consistency assertions (NFC)
Author: Nikita Popov Date: 2023-06-09T09:45:43+02:00 New Revision: 2c44168381f0b06eb629cd093510a9fca6913066 URL: https://github.com/llvm/llvm-project/commit/2c44168381f0b06eb629cd093510a9fca6913066 DIFF: https://github.com/llvm/llvm-project/commit/2c44168381f0b06eb629cd093510a9fca6913066.diff LOG: [Clang] Remove typed pointer consistency assertions (NFC) These are no-ops with opaque pointers. Added: Modified: clang/lib/CodeGen/Address.h clang/lib/CodeGen/CGBuilder.h clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGValue.h Removed: diff --git a/clang/lib/CodeGen/Address.h b/clang/lib/CodeGen/Address.h index a45df7f8497e4..e020d95344ade 100644 --- a/clang/lib/CodeGen/Address.h +++ b/clang/lib/CodeGen/Address.h @@ -41,9 +41,6 @@ class Address { ElementType(ElementType), Alignment(Alignment) { assert(Pointer != nullptr && "Pointer cannot be null"); assert(ElementType != nullptr && "Element type cannot be null"); -assert(llvm::cast(Pointer->getType()) - ->isOpaqueOrPointeeTypeMatches(ElementType) && - "Incorrect pointer element type"); } static Address invalid() { return Address(nullptr); } diff --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h index f18d8be5ecd9d..902fd94570837 100644 --- a/clang/lib/CodeGen/CGBuilder.h +++ b/clang/lib/CodeGen/CGBuilder.h @@ -89,8 +89,6 @@ class CGBuilderTy : public CGBuilderBaseTy { llvm::LoadInst *CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine = "") { -assert(llvm::cast(Addr->getType()) - ->isOpaqueOrPointeeTypeMatches(Ty)); return CreateAlignedLoad(Ty, Addr, Align.getAsAlign(), Name); } @@ -120,15 +118,11 @@ class CGBuilderTy : public CGBuilderBaseTy { /// Emit a load from an i1 flag variable. llvm::LoadInst *CreateFlagLoad(llvm::Value *Addr, const llvm::Twine = "") { -assert(llvm::cast(Addr->getType()) - ->isOpaqueOrPointeeTypeMatches(getInt1Ty())); return CreateAlignedLoad(getInt1Ty(), Addr, CharUnits::One(), Name); } /// Emit a store to an i1 flag variable. llvm::StoreInst *CreateFlagStore(bool Value, llvm::Value *Addr) { -assert(llvm::cast(Addr->getType()) - ->isOpaqueOrPointeeTypeMatches(getInt1Ty())); return CreateAlignedStore(getInt1(Value), Addr, CharUnits::One()); } @@ -157,9 +151,6 @@ class CGBuilderTy : public CGBuilderBaseTy { using CGBuilderBaseTy::CreateAddrSpaceCast; Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty, const llvm::Twine = "") { -assert(cast(Ty)->isOpaqueOrPointeeTypeMatches( - Addr.getElementType()) && - "Should not change the element type"); return Addr.withPointer(CreateAddrSpaceCast(Addr.getPointer(), Ty, Name), Addr.isKnownNonNull()); } diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index eb45e82fe8256..d39131828c066 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -4912,25 +4912,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo , CGM, Loc, dyn_cast_or_null(CurCodeDecl), FD, CallArgs); } -#ifndef NDEBUG - if (!(CallInfo.isVariadic() && CallInfo.getArgStruct())) { -// For an inalloca varargs function, we don't expect CallInfo to match the -// function pointer's type, because the inalloca struct a will have extra -// fields in it for the varargs parameters. Code later in this function -// bitcasts the function pointer to the type derived from CallInfo. -// -// In other cases, we assert that the types match up (until pointers stop -// having pointee types). -if (Callee.isVirtual()) - assert(IRFuncTy == Callee.getVirtualFunctionType()); -else { - llvm::PointerType *PtrTy = - llvm::cast(Callee.getFunctionPointer()->getType()); - assert(PtrTy->isOpaqueOrPointeeTypeMatches(IRFuncTy)); -} - } -#endif - // 1. Set up the arguments. // If we're using inalloca, insert the allocation after the stack save. diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index bbbe4749cdfb0..4c5d14e1e7028 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1405,9 +1405,6 @@ void CodeGenFunction::EmitAndRegisterVariableArrayDimensions( else { // Create an artificial VarDecl to generate debug info for. IdentifierInfo *NameIdent = VLAExprNames[NameIdx++]; - assert(cast(VlaSize.NumElts->getType()) - ->isOpaqueOrPointeeTypeMatches(SizeTy) && - "Number of VLA elements must be SizeTy"); auto QT =
[clang] 066fb7a - [Clang] Remove -no-opaque-pointers cc1 flag
Author: Nikita Popov Date: 2023-06-08T17:52:20+02:00 New Revision: 066fb7a58c5a0dd518d0841ed8f32f86d9f798ec URL: https://github.com/llvm/llvm-project/commit/066fb7a58c5a0dd518d0841ed8f32f86d9f798ec DIFF: https://github.com/llvm/llvm-project/commit/066fb7a58c5a0dd518d0841ed8f32f86d9f798ec.diff LOG: [Clang] Remove -no-opaque-pointers cc1 flag Migration of clang tests to opaque pointers is finished, so remove the -no-opaque-pointers flag. Differential Revision: https://reviews.llvm.org/D152447 Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td clang/lib/CodeGen/CodeGenAction.cpp llvm/docs/OpaquePointers.rst Removed: clang/test/CodeGen/opaque-pointers-flag.c clang/test/CodeGenOpenCL/opaque-ptr-spirv.cl diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b17e746976573..85573dc7f466b 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -254,6 +254,7 @@ Removed Compiler Flags - The CodeGen flag `-lower-global-dtors-via-cxa-atexit` which affects how global destructors are lowered for MachO is removed without replacement. The default of `-lower-global-dtors-via-cxa-atexit=true` is now the only supported way. +- The cc1 flag ``-no-opaque-pointers`` has been removed. Attribute Changes in Clang -- diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 53d92c4c76673..9cd911e7fce14 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -501,9 +501,6 @@ CODEGENOPT(SkipRaxSetup, 1, 0) ENUM_CODEGENOPT(ZeroCallUsedRegs, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind, 5, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Skip) -/// Whether to use opaque pointers. -CODEGENOPT(OpaquePointers, 1, 0) - /// Modify C++ ABI to returning `this` pointer from constructors and /// non-deleting destructors. (No effect on Microsoft ABI.) CODEGENOPT(CtorDtorReturnThis, 1, 0) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 7fad5b27fdb6e..7934afa52af84 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6029,13 +6029,6 @@ defm enable_noundef_analysis : BoolOption<"", PosFlag, NegFlag, BothFlags<[], " analyzing function argument and return types for mandatory definedness">>; -defm opaque_pointers : BoolOption<"", - "opaque-pointers", - CodeGenOpts<"OpaquePointers">, - DefaultTrue, - PosFlag, - NegFlag, - BothFlags<[], " opaque pointers">>; def discard_value_names : Flag<["-"], "discard-value-names">, HelpText<"Discard value names in LLVM IR">, MarshallingInfoFlag>; diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index b93477fdbf0aa..4aa51e956655f 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -1047,8 +1047,6 @@ CodeGenAction::CreateASTConsumer(CompilerInstance , StringRef InFile) { if (BA != Backend_EmitNothing && !OS) return nullptr; - VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); - // Load bitcode modules to link with, if we need to. if (LinkModules.empty()) for (const CodeGenOptions::BitcodeFileToLink : @@ -1106,8 +1104,6 @@ CodeGenAction::loadModule(MemoryBufferRef MBRef) { CompilerInstance = getCompilerInstance(); SourceManager = CI.getSourceManager(); - VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); - // For ThinLTO backend invocations, ensure that the context // merges types based on ODR identifiers. We also need to read // the correct module out of a multi-module bitcode file. diff --git a/clang/test/CodeGen/opaque-pointers-flag.c b/clang/test/CodeGen/opaque-pointers-flag.c deleted file mode 100644 index 1fbff99f8ef60..0 --- a/clang/test/CodeGen/opaque-pointers-flag.c +++ /dev/null @@ -1,25 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED -// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE - -// TYPED-LABEL: @test( -// TYPED-NEXT: entry: -// TYPED-NEXT:[[P_ADDR:%.*]] = alloca ptr, align 8 -// TYPED-NEXT:store ptr [[P:%.*]], ptr [[P_ADDR]], align 8 -// TYPED-NEXT:[[TMP0:%.*]] = load ptr, ptr [[P_ADDR]], align 8 -// TYPED-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1 -// TYPED-NEXT:[[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 -// TYPED-NEXT:ret i32 [[TMP1]] -// -// OPAQUE-LABEL: @test( -// OPAQUE-NEXT: entry: -// OPAQUE-NEXT:[[P_ADDR:%.*]] =
[clang] 0f0623a - [Clang] Remove some explicit -opaque-pointers options in tests (NFC)
Author: Nikita Popov Date: 2023-06-08T17:41:27+02:00 New Revision: 0f0623ab87e9041fe0df1e788958330a2787a494 URL: https://github.com/llvm/llvm-project/commit/0f0623ab87e9041fe0df1e788958330a2787a494 DIFF: https://github.com/llvm/llvm-project/commit/0f0623ab87e9041fe0df1e788958330a2787a494.diff LOG: [Clang] Remove some explicit -opaque-pointers options in tests (NFC) This is the default, so don't specify it explicitly, in preparation for removing the option. Added: Modified: clang/test/CodeGen/arithmetic-fence-builtin.cpp clang/test/CodeGen/disable-tail-calls.c clang/test/CodeGen/dominating-store-to-return.c clang/test/CoverageMapping/ir.c clang/test/Driver/arm-float-abi-lto.c clang/test/Driver/memtag-stack_lto.c Removed: diff --git a/clang/test/CodeGen/arithmetic-fence-builtin.cpp b/clang/test/CodeGen/arithmetic-fence-builtin.cpp index b0fc5ce60a602..a8f434c1d60c3 100644 --- a/clang/test/CodeGen/arithmetic-fence-builtin.cpp +++ b/clang/test/CodeGen/arithmetic-fence-builtin.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -mreassociate -o - %s \ -// RUN: -opaque-pointers | FileCheck --check-prefix CHECK %s +// RUN: | FileCheck --check-prefix CHECK %s // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -mreassociate -o - %s \ -// RUN: -opaque-pointers | FileCheck --check-prefix CHECK %s +// RUN: | FileCheck --check-prefix CHECK %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -mreassociate \ -// RUN: -fprotect-parens -ffp-contract=on -o - %s -opaque-pointers \ +// RUN: -fprotect-parens -ffp-contract=on -o - %s \ // RUN: | FileCheck --check-prefix CHECK %s template T addAF(T a, T b) { diff --git a/clang/test/CodeGen/disable-tail-calls.c b/clang/test/CodeGen/disable-tail-calls.c index 11842faa1e3ba..e53c065072a46 100644 --- a/clang/test/CodeGen/disable-tail-calls.c +++ b/clang/test/CodeGen/disable-tail-calls.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -opaque-pointers -emit-llvm -O2 -fno-optimize-sibling-calls -o - < %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -emit-llvm -O2 -fno-optimize-sibling-calls -o - < %s | FileCheck %s typedef struct List { struct List *next; diff --git a/clang/test/CodeGen/dominating-store-to-return.c b/clang/test/CodeGen/dominating-store-to-return.c index 42595c5296098..1c53e358cf146 100644 --- a/clang/test/CodeGen/dominating-store-to-return.c +++ b/clang/test/CodeGen/dominating-store-to-return.c @@ -1,6 +1,6 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=NO-LIFETIME -// RUN: %clang_cc1 -opaque-pointers -O1 -disable-llvm-optzns -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=LIFETIME +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=NO-LIFETIME +// RUN: %clang_cc1 -O1 -disable-llvm-optzns -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=LIFETIME // NO-LIFETIME-LABEL: @main( // NO-LIFETIME-NEXT: entry: diff --git a/clang/test/CoverageMapping/ir.c b/clang/test/CoverageMapping/ir.c index 6fa9281ab70df..b08734cc35113 100644 --- a/clang/test/CoverageMapping/ir.c +++ b/clang/test/CoverageMapping/ir.c @@ -1,6 +1,5 @@ // Check the data structures emitted by coverage mapping // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false | FileCheck %s -check-prefixes=COMMON,DARWIN -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -opaque-pointers | FileCheck %s -check-prefixes=COMMON,DARWIN // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64--windows-msvc -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false | FileCheck %s -check-prefixes=COMMON,WINDOWS static inline void unused(void) {} diff --git a/clang/test/Driver/arm-float-abi-lto.c b/clang/test/Driver/arm-float-abi-lto.c index b8788f485cbff..83c2435d97a4d 100644 --- a/clang/test/Driver/arm-float-abi-lto.c +++ b/clang/test/Driver/arm-float-abi-lto.c @@ -2,8 +2,8 @@ // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -S -o - -emit-llvm -DCALL_LIB -DDEFINE_LIB | FileCheck %s -// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=full -c -o %t.call_full.bc -DCALL_LIB -// RUN: %clang --target=arm-none-eabi
[clang] 32791f1 - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-06-08T16:39:57+02:00 New Revision: 32791f19fd354f58aea9114b6c56301966bdd802 URL: https://github.com/llvm/llvm-project/commit/32791f19fd354f58aea9114b6c56301966bdd802 DIFF: https://github.com/llvm/llvm-project/commit/32791f19fd354f58aea9114b6c56301966bdd802.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) These tests all require some adjustments to make sure that struct types still get generated, mostly done by stripping pointer indirections. Some of this may no longer test the situation it was originally intended for, e.g. the issue from pr18962 just doesn't really exist anymore with opaque pointers, as we no longer generate recursive types. Added: Modified: clang/test/CodeGenCXX/class-layout.cpp clang/test/CodeGenCXX/member-data-pointers.cpp clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp clang/test/CodeGenCXX/pr18962.cpp Removed: diff --git a/clang/test/CodeGenCXX/class-layout.cpp b/clang/test/CodeGenCXX/class-layout.cpp index 22f38540a5670..9e2e9cd74c70f 100644 --- a/clang/test/CodeGenCXX/class-layout.cpp +++ b/clang/test/CodeGenCXX/class-layout.cpp @@ -1,21 +1,21 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // An extra byte should be allocated for an empty class. namespace Test1 { // CHECK: %"struct.Test1::A" = type { i8 } - struct A { } *a; + struct A { } a; } namespace Test2 { // No need to add tail padding here. - // CHECK: %"struct.Test2::A" = type { i8*, i32 } - struct A { void *a; int b; } *a; + // CHECK: %"struct.Test2::A" = type { ptr, i32 } + struct A { void *a; int b; } a; } namespace Test3 { // C should have a vtable pointer. - // CHECK: %"struct.Test3::A" = type <{ i32 (...)**, i32, [4 x i8] }> - struct A { virtual void f(); int a; } *a; + // CHECK: %"struct.Test3::A" = type <{ ptr, i32, [4 x i8] }> + struct A { virtual void f(); int a; } a; } namespace Test4 { @@ -30,7 +30,7 @@ namespace Test4 { struct B : public A { short d; double e; - } *b; + } b; } namespace Test5 { @@ -43,7 +43,7 @@ namespace Test5 { struct B : A { char b : 1; char c; - } *b; + } b; } // PR10912: don't crash @@ -83,12 +83,12 @@ namespace Test6 { namespace Test7 { #pragma pack (1) class A {}; - // CHECK: %"class.Test7::B" = type <{ i32 (...)**, %"class.Test7::A" }> + // CHECK: %"class.Test7::B" = type <{ ptr, %"class.Test7::A" }> class B { virtual ~B(); A a; }; - B* b; + B test(B b) { return b; } #pragma pack () } diff --git a/clang/test/CodeGenCXX/member-data-pointers.cpp b/clang/test/CodeGenCXX/member-data-pointers.cpp index 22cc1016fa7f1..8b4e8d2797072 100644 --- a/clang/test/CodeGenCXX/member-data-pointers.cpp +++ b/clang/test/CodeGenCXX/member-data-pointers.cpp @@ -1,13 +1,13 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-unknown-unknown | FileCheck -check-prefix GLOBAL-LP64 %s -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=armv7-unknown-unknown | FileCheck -check-prefix GLOBAL-LP32 %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-unknown-unknown | FileCheck -check-prefix GLOBAL-LP64 %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-unknown | FileCheck -check-prefix GLOBAL-LP32 %s struct A; typedef int A::*param_t; struct { const char *name; param_t par; -} *ptr; +} ptr; void test_ptr() { (void) ptr; } // forced use -// GLOBAL-LP64: type { i8*, i64 } -// GLOBAL-LP32: type { i8*, i32 } +// GLOBAL-LP64: type { ptr, i64 } +// GLOBAL-LP32: type { ptr, i32 } diff --git a/clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp b/clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp index d64fc60d15f99..2d218e2aab10d 100644 --- a/clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp +++ b/clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp @@ -1,20 +1,25 @@ -// RUN: %clang_cc1 -no-opaque-pointers -fms-compatibility -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fms-compatibility -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s // Make sure we choose the *direct* base path when doing these conversions. -// CHECK: %struct.C = type { %struct.A, %struct.B } -// CHECK: %struct.D = type { %struct.B, %struct.A } - struct A { int a; }; struct B : A { int b; }; struct C : A, B { }; extern "C" A *a_from_c(C *p) { return p; } -// CHECK-LABEL: define dso_local %struct.A* @a_from_c(%struct.C* noundef %{{.*}}) -// CHECK: bitcast %struct.C* %{{.*}} to %struct.A* +// CHECK-LABEL: define dso_local ptr @a_from_c(ptr noundef %{{.*}}) +// CHECK: [[P_ADDR:%.*]] = alloca ptr +// CHECK-NEXT: store ptr [[P:%.*]], ptr [[P_ADDR]] +// CHECK-NEXT: [[RET:%.*]] = load
[clang] d3d5cdb - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-06-08T10:01:28+02:00 New Revision: d3d5cdbfa8a9f2838531466d321feb82f3c08b9d URL: https://github.com/llvm/llvm-project/commit/d3d5cdbfa8a9f2838531466d321feb82f3c08b9d DIFF: https://github.com/llvm/llvm-project/commit/d3d5cdbfa8a9f2838531466d321feb82f3c08b9d.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGenCXX/PR24289.cpp clang/test/CodeGenCXX/arm-vaarg.cpp clang/test/CodeGenCXX/builtin-source-location.cpp clang/test/CodeGenCXX/cp-blocks-linetables.cpp clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp clang/test/CodeGenCXX/matrix-type.cpp Removed: diff --git a/clang/test/CodeGenCXX/PR24289.cpp b/clang/test/CodeGenCXX/PR24289.cpp index de52c3469be40..e466235674a35 100644 --- a/clang/test/CodeGenCXX/PR24289.cpp +++ b/clang/test/CodeGenCXX/PR24289.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu -std=c++11 | FileCheck %s +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu -std=c++11 | FileCheck %s namespace std { template @@ -24,8 +24,7 @@ void f() { {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}; } -// CHECK-DAG: @_ZZ1fvE1a = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([14 x %{{.*}}], [14 x %{{.*}}] -// CHECK-DAG: * @_ZGRZ1fvE1a_, i32 0, i32 0), i64 14 } +// CHECK-DAG: @_ZZ1fvE1a = internal global %{{.*}} { ptr @_ZGRZ1fvE1a_, i64 14 } // CHECK-DAG: @_ZGRZ1fvE1a0_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1a1_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1a2_ = internal constant [1 x i32] zeroinitializer @@ -40,16 +39,16 @@ void f() { // CHECK-DAG: @_ZGRZ1fvE1aB_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1aC_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1aD_ = internal constant [1 x i32] zeroinitializer -// CHECK-DAG: @_ZGRZ1fvE1a_ = internal constant [14 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a3_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a4_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a5_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a6_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a7_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a8_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a9_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aA_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aB_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aC_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aD_, i32 0, i32 0), i64 1 }] -// CHECK-DAG: @_ZZ1fvE1b = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([4 x %{{.*}}], [4 x %{{.*}}]* -// CHECK-DAG: @_ZGRZ1fvE1b_, i32 0, i32 0), i64 4 } +// CHECK-DAG: @_ZGRZ1fvE1a_ = internal constant [14 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1a0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a3_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a4_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a5_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a6_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a7_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a8_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a9_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aA_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aB_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aC_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aD_, i64 1 }] +// CHECK-DAG: @_ZZ1fvE1b = internal global %{{.*}} { ptr +// CHECK-DAG: @_ZGRZ1fvE1b_, i64 4 } // CHECK-DAG: @_ZGRZ1fvE1b0_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1b1_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1b2_ = internal constant [1 x i32] zeroinitializer // CHECK-DAG: @_ZGRZ1fvE1b3_ = internal constant [1 x i32] zeroinitializer -// CHECK-DAG: @_ZGRZ1fvE1b_ = internal constant [4 x %{{.*}}] [%{{.*}} { i32*
[clang] 2c3c190 - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-06-01T17:04:48+02:00 New Revision: 2c3c1902a347a2a6d681e8dbe410a2dfe78389bb URL: https://github.com/llvm/llvm-project/commit/2c3c1902a347a2a6d681e8dbe410a2dfe78389bb DIFF: https://github.com/llvm/llvm-project/commit/2c3c1902a347a2a6d681e8dbe410a2dfe78389bb.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGenObjCXX/property-dot-reference.mm clang/test/CodeGenObjCXX/property-lvalue-lambda.mm clang/test/CodeGenObjCXX/property-object-conditional-exp.mm clang/test/CodeGenObjCXX/property-object-reference-1.mm clang/test/CodeGenObjCXX/property-object-reference.mm clang/test/CodeGenObjCXX/property-objects.mm clang/test/CodeGenObjCXX/property-reference.mm Removed: diff --git a/clang/test/CodeGenObjCXX/property-dot-reference.mm b/clang/test/CodeGenObjCXX/property-dot-reference.mm index 126676d4f0346..9fb35858219f8 100644 --- a/clang/test/CodeGenObjCXX/property-dot-reference.mm +++ b/clang/test/CodeGenObjCXX/property-dot-reference.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s // rdar://8409336 struct TFENode { @@ -11,8 +11,8 @@ @interface TNodeIconAndNameCell @implementation TNodeIconAndNameCell - (const TFENode&) node { -// CHECK: call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* {{[^,]*}} %{{.*}}) +// CHECK: call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @objc_msgSend +// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(ptr {{[^,]*}} %{{.*}}) self.node.GetURL(); } // expected-warning {{non-void function does not return a value}} @end @@ -27,12 +27,12 @@ @interface A - (const X&) target; @end void f1(A *a) { -// CHECK: [[PRP:%.*]] = call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[PRP]]) +// CHECK: [[PRP:%.*]] = call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @objc_msgSend +// CHECK-NEXT:call void @_Z2f0RK1X(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[PRP]]) f0(a.target); -// CHECK: [[MSG:%.*]] = call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend -// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[MSG]]) +// CHECK: [[MSG:%.*]] = call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @objc_msgSend +// CHECK-NEXT:call void @_Z2f0RK1X(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[MSG]]) f0([a target]); } @@ -51,12 +51,12 @@ void test2() { void(obj.myGetter); } // CHECK-LABEL: define{{.*}} void @_Z5test2v() -// CHECK: call noundef i32 bitcast -// CHECK: call noundef double bitcast -// CHECK: call noundef i32 bitcast -// CHECK: call noundef double bitcast -// CHECK: call noundef i32 bitcast -// CHECK: call noundef double bitcast +// CHECK: call noundef i32 +// CHECK: call noundef double +// CHECK: call noundef i32 +// CHECK: call noundef double +// CHECK: call noundef i32 +// CHECK: call noundef double // PR8751 int test3(Test2 *obj) { return obj.myProperty; } diff --git a/clang/test/CodeGenObjCXX/property-lvalue-lambda.mm b/clang/test/CodeGenObjCXX/property-lvalue-lambda.mm index 1253ae6d45b04..ddb0bf5570926 100644 --- a/clang/test/CodeGenObjCXX/property-lvalue-lambda.mm +++ b/clang/test/CodeGenObjCXX/property-lvalue-lambda.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -fblocks -disable-llvm-passes -triple x86_64-apple-darwin10 -std=c++17 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -fblocks -disable-llvm-passes -triple x86_64-apple-darwin10 -std=c++17 -emit-llvm -o - %s | FileCheck %s typedef void (^blk_t)(); typedef void (*fnptr_t)(); @@ -19,12 +19,12 @@ void t1(X *x) { // Check that we call lambda.operator blk_t(), and that we send that result to // the setter. - // CHECK: [[CALL:%.*]] = call void ()* @"_ZZ2t1P1XENK3$_0cvU13block_pointerFvvEEv" - // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} void ()* [[CALL]]) + // CHECK: [[CALL:%.*]] = call ptr @"_ZZ2t1P1XENK3$_0cvU13block_pointerFvvEEv" + // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} ptr [[CALL]]) x.blk = [] {}; - // CHECK: [[CALL2:%.*]] = call void ()* @"_ZZ2t1P1XENK3$_1cvPFvvEEv" - // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} void ()*
[clang] 28776d5 - [Driver] Try to fix linux-ld.c test with DEFAULT_LINKER set (NFC)
Author: Nikita Popov Date: 2023-05-23T16:05:27+02:00 New Revision: 28776d501cad38d56b8e05ba1ec5044c88901d7a URL: https://github.com/llvm/llvm-project/commit/28776d501cad38d56b8e05ba1ec5044c88901d7a DIFF: https://github.com/llvm/llvm-project/commit/28776d501cad38d56b8e05ba1ec5044c88901d7a.diff LOG: [Driver] Try to fix linux-ld.c test with DEFAULT_LINKER set (NFC) The test fails on the clang-ppc64le-rhel build bot, which has DEFAULT_LINKER set and an ld.lld binary in the LLVM build directory. Added: Modified: clang/test/Driver/linux-ld.c Removed: diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c index 18ad0b9aa07b..287750ac2046 100644 --- a/clang/test/Driver/linux-ld.c +++ b/clang/test/Driver/linux-ld.c @@ -1791,7 +1791,7 @@ // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" -// RUN: %clang -### %s -no-pie 2>&1 \ +// RUN: %clang -### %s -no-pie -fuse-ld=ld 2>&1 \ // RUN: --target=x86_64-unknown-linux-gnu \ // RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ // RUN: --sysroot="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root" \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 75cce50 - [Driver] Fix test for use of ld from devtoolset (NFC)
Author: Nikita Popov Date: 2023-05-23T13:53:17+02:00 New Revision: 75cce50fd2d3869b97d66c280dc2b2c34f9b2818 URL: https://github.com/llvm/llvm-project/commit/75cce50fd2d3869b97d66c280dc2b2c34f9b2818 DIFF: https://github.com/llvm/llvm-project/commit/75cce50fd2d3869b97d66c280dc2b2c34f9b2818.diff LOG: [Driver] Fix test for use of ld from devtoolset (NFC) The test added in c5fe10f365247c3dd9416b7ec8bad73a60b5946e contains some typos in the check lines, due to which it never actually verified what was intended. Fix the test by adding the required input tree and adjusting the check lines appropriately. Differential Revision: https://reviews.llvm.org/D151195 Added: clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/bin/ld clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtend.o Modified: clang/test/Driver/linux-ld.c Removed: diff --git a/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/bin/ld b/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/bin/ld new file mode 100755 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o new file mode 100644 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtend.o b/clang/test/Driver/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/crtend.o new file mode 100644 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c index 512fccbd6503d..18ad0b9aa07b7 100644 --- a/clang/test/Driver/linux-ld.c +++ b/clang/test/Driver/linux-ld.c @@ -1794,12 +1794,11 @@ // RUN: %clang -### %s -no-pie 2>&1 \ // RUN: --target=x86_64-unknown-linux-gnu \ // RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ -// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: --sysroot="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root" \ // RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s -// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld -// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld +// CHECK-LD-RHEL7-DTS: [[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7/../../../../bin/ld // Check whether gcc7 install works fine on Amazon Linux AMI // RUN: %clang -### %s -no-pie 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] 382b56d - [libclc] Fix linking against libLLVMSupport
Author: Thomas Debesse Date: 2023-05-22T12:22:05+02:00 New Revision: 382b56d5bd0356ba53bbaf9bfb988f315a7530b5 URL: https://github.com/llvm/llvm-project/commit/382b56d5bd0356ba53bbaf9bfb988f315a7530b5 DIFF: https://github.com/llvm/llvm-project/commit/382b56d5bd0356ba53bbaf9bfb988f315a7530b5.diff LOG: [libclc] Fix linking against libLLVMSupport Fixes https://github.com/llvm/llvm-project/issues/62018. Added: Modified: libclc/CMakeLists.txt Removed: diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 0eda12670b710..4a1c8b1ba4932 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -115,6 +115,7 @@ set(LLVM_LINK_COMPONENTS BitReader BitWriter Core + Support ) add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp ) target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] cac4d7f - [CodeGen] Only consider innermost cast for !heapallocsite
Author: Nikita Popov Date: 2023-05-09T09:49:42+02:00 New Revision: cac4d7ff4652815e12132c990a62d68873ba4b9e URL: https://github.com/llvm/llvm-project/commit/cac4d7ff4652815e12132c990a62d68873ba4b9e DIFF: https://github.com/llvm/llvm-project/commit/cac4d7ff4652815e12132c990a62d68873ba4b9e.diff LOG: [CodeGen] Only consider innermost cast for !heapallocsite Without opaque pointers, this code determined !heapallocsite based on the innermost cast of the allocation call. With opaque pointers, the casts no longer generate an instruction, so the outermost cast is used. Add an explicit check for nested casts to prevent this. Differential Revision: https://reviews.llvm.org/D145788 Added: Modified: clang/lib/CodeGen/CGExprScalar.cpp clang/test/CodeGen/debug-info-codeview-heapallocsite.c Removed: diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 2243c75ed2608..cf24e3211dbc3 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2098,7 +2098,8 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { // Update heapallocsite metadata when there is an explicit pointer cast. if (auto *CI = dyn_cast(Src)) { - if (CI->getMetadata("heapallocsite") && isa(CE)) { + if (CI->getMetadata("heapallocsite") && isa(CE) && + !isa(E)) { QualType PointeeType = DestTy->getPointeeType(); if (!PointeeType.isNull()) CGF.getDebugInfo()->addHeapAllocSiteMetadata(CI, PointeeType, diff --git a/clang/test/CodeGen/debug-info-codeview-heapallocsite.c b/clang/test/CodeGen/debug-info-codeview-heapallocsite.c index a8cae112dcec2..6cc34f688e4dc 100644 --- a/clang/test/CodeGen/debug-info-codeview-heapallocsite.c +++ b/clang/test/CodeGen/debug-info-codeview-heapallocsite.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm %s -o - | FileCheck %s struct Foo; struct Bar; @@ -14,10 +14,10 @@ void call_alloc(void) { } // CHECK-LABEL: define {{.*}}void @call_alloc -// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]] -// CHECK: call %struct.Foo* {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]] -// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG2]] -// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG3:!.*]] +// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]] +// CHECK: call ptr {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]] +// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG2]] +// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG3:!.*]] // CHECK: [[DBG2]] = !DICompositeType(tag: DW_TAG_structure_type, // CHECK-SAME: name: "Foo" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 946b326 - [InstSimplify] sdiv a (1 srem b) --> a
Author: Siyuan Zhu Date: 2023-04-24T14:37:07+02:00 New Revision: 946b32680311f43a349d0199f9e286f385cd9847 URL: https://github.com/llvm/llvm-project/commit/946b32680311f43a349d0199f9e286f385cd9847 DIFF: https://github.com/llvm/llvm-project/commit/946b32680311f43a349d0199f9e286f385cd9847.diff LOG: [InstSimplify] sdiv a (1 srem b) --> a Extend the existing fold for division by zero or one to use known bits, so it catches additional patterns like division by (1 srem b). Fixes https://github.com/llvm/llvm-project/issues/62163. Differential Revision: https://reviews.llvm.org/D149001 Added: Modified: clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp clang/test/OpenMP/for_reduction_task_codegen.cpp clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp clang/test/OpenMP/parallel_reduction_task_codegen.cpp clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp clang/test/OpenMP/sections_reduction_task_codegen.cpp clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp clang/test/OpenMP/teams_distribute_parallel_for_reduction_task_codegen.cpp llvm/lib/Analysis/InstructionSimplify.cpp llvm/test/Transforms/InstCombine/zext-or-icmp.ll llvm/test/Transforms/InstSimplify/div.ll Removed: diff --git a/clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp b/clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp index 7cd29b2f70574..de9b18bbb5fba 100644 --- a/clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp +++ b/clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp @@ -568,22 +568,20 @@ int main(int argc, char **argv) { // CHECK1-NEXT:[[TMP28:%.*]] = ptrtoint ptr [[ARRAYIDX3_I]] to i64 // CHECK1-NEXT:[[TMP29:%.*]] = ptrtoint ptr [[TMP20]] to i64 // CHECK1-NEXT:[[TMP30:%.*]] = sub i64 [[TMP28]], [[TMP29]] -// CHECK1-NEXT:[[TMP31:%.*]] = sdiv exact i64 [[TMP30]], ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64) -// CHECK1-NEXT:[[TMP32:%.*]] = add nuw i64 [[TMP31]], 1 -// CHECK1-NEXT:[[TMP33:%.*]] = mul nuw i64 [[TMP32]], ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64) -// CHECK1-NEXT:store i64 [[TMP32]], ptr @{{reduction_size[.].+[.]}}, align 8, !noalias !12 -// CHECK1-NEXT:[[TMP34:%.*]] = load ptr, ptr [[TMP12]], align 8 -// CHECK1-NEXT:[[TMP35:%.*]] = call ptr @__kmpc_task_reduction_get_th_data(i32 [[TMP16]], ptr [[TMP34]], ptr [[TMP20]]) -// CHECK1-NEXT:[[TMP36:%.*]] = getelementptr inbounds [[STRUCT_ANON]], ptr [[TMP9]], i32 0, i32 2 +// CHECK1-NEXT:[[TMP31:%.*]] = add nuw i64 [[TMP30]], 1 +// CHECK1-NEXT:[[TMP32:%.*]] = mul nuw i64 [[TMP31]], ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64) +// CHECK1-NEXT:store i64 [[TMP31]], ptr @{{reduction_size[.].+[.]}}, align 8, !noalias !12 +// CHECK1-NEXT:[[TMP33:%.*]] = load ptr, ptr [[TMP12]], align 8 +// CHECK1-NEXT:[[TMP34:%.*]] = call ptr @__kmpc_task_reduction_get_th_data(i32 [[TMP16]], ptr [[TMP33]], ptr [[TMP20]]) +// CHECK1-NEXT:[[TMP35:%.*]] = getelementptr inbounds [[STRUCT_ANON]], ptr [[TMP9]], i32 0, i32 2 +// CHECK1-NEXT:[[TMP36:%.*]] = load ptr, ptr [[TMP35]], align 8 // CHECK1-NEXT:[[TMP37:%.*]] = load ptr, ptr [[TMP36]], align 8 -// CHECK1-NEXT:[[TMP38:%.*]] = load ptr, ptr [[TMP37]], align 8 -// CHECK1-NEXT:[[TMP39:%.*]] = ptrtoint ptr [[TMP38]] to i64 -// CHECK1-NEXT:[[TMP40:%.*]] = ptrtoint ptr [[TMP20]] to i64 -// CHECK1-NEXT:[[TMP41:%.*]] = sub i64 [[TMP39]], [[TMP40]] -// CHECK1-NEXT:[[TMP42:%.*]] = sdiv exact i64 [[TMP41]], ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64) -// CHECK1-NEXT:[[TMP43:%.*]] = getelementptr i8, ptr [[TMP35]], i64 [[TMP42]] +// CHECK1-NEXT:[[TMP38:%.*]] = ptrtoint ptr [[TMP37]] to i64 +// CHECK1-NEXT:[[TMP39:%.*]] = ptrtoint ptr [[TMP20]] to i64 +// CHECK1-NEXT:[[TMP40:%.*]] = sub i64 [[TMP38]], [[TMP39]] +// CHECK1-NEXT:[[TMP41:%.*]] = getelementptr i8, ptr [[TMP34]], i64 [[TMP40]] // CHECK1-NEXT:store ptr [[TMP4_I]], ptr [[TMP_I]], align 8, !noalias !12 -// CHECK1-NEXT:store ptr [[TMP43]], ptr [[TMP4_I]], align 8, !noalias !12 +// CHECK1-NEXT:store ptr [[TMP41]], ptr [[TMP4_I]], align 8, !noalias !12 // CHECK1-NEXT:ret i32 0 // // diff --git a/clang/test/OpenMP/for_reduction_task_codegen.cpp b/clang/test/OpenMP/for_reduction_task_codegen.cpp index 687aa973dde27..48587ce9a34b6 100644 --- a/clang/test/OpenMP/for_reduction_task_codegen.cpp +++ b/clang/test/OpenMP/for_reduction_task_codegen.cpp @@ -481,22 +481,20 @@ int main(int argc, char **argv) { // CHECK1-NEXT:[[TMP28:%.*]]
[clang] e7e4c76 - [Pipelines] Don't run ForceFunctionAttrs post-link
Author: Nikita Popov Date: 2023-04-24T09:58:06+02:00 New Revision: e7e4c7632075fef21bc8f90ad76dc68680e3bac8 URL: https://github.com/llvm/llvm-project/commit/e7e4c7632075fef21bc8f90ad76dc68680e3bac8 DIFF: https://github.com/llvm/llvm-project/commit/e7e4c7632075fef21bc8f90ad76dc68680e3bac8.diff LOG: [Pipelines] Don't run ForceFunctionAttrs post-link This is effectively a debugging pass to adjust function attributes. I don't think it makes sense to run it in the post-link pipeline. Differential Revision: https://reviews.llvm.org/D148904 Added: Modified: clang/test/CodeGen/thinlto-distributed-newpm.ll llvm/lib/Passes/PassBuilderPipelines.cpp llvm/test/Other/new-pm-lto-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll Removed: diff --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll b/clang/test/CodeGen/thinlto-distributed-newpm.ll index 57e2011f55aed..c85ce0f6a27da 100644 --- a/clang/test/CodeGen/thinlto-distributed-newpm.ll +++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll @@ -21,7 +21,6 @@ ; CHECK-O: Running pass: WholeProgramDevirtPass ; CHECK-O: Running pass: LowerTypeTestsPass -; CHECK-O: Running pass: ForceFunctionAttrsPass ; CHECK-O: Running pass: PGOIndirectCallPromotion ; CHECK-O: Running pass: InferFunctionAttrsPass ; CHECK-O: Running pass: LowerExpectIntrinsicPass on main diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 4fa7326b24719..4407ad0131e12 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1557,9 +1557,6 @@ ModulePassManager PassBuilder::buildThinLTODefaultPipeline( return MPM; } - // Force any function attributes we want the rest of the pipeline to observe. - MPM.addPass(ForceFunctionAttrsPass()); - // Add the core simplification pipeline. MPM.addPass(buildModuleSimplificationPipeline( Level, ThinOrFullLTOPhase::ThinLTOPostLink)); @@ -1626,9 +1623,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, // whole-program devirtualization and bitset lowering. MPM.addPass(GlobalDCEPass()); - // Force any function attributes we want the rest of the pipeline to observe. - MPM.addPass(ForceFunctionAttrsPass()); - // Do basic inference of function attributes from known properties of system // libraries and other oracles. MPM.addPass(InferFunctionAttrsPass()); diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll index 7fc0185070ece..eb4ad0610b326 100644 --- a/llvm/test/Other/new-pm-lto-defaults.ll +++ b/llvm/test/Other/new-pm-lto-defaults.ll @@ -31,7 +31,6 @@ ; CHECK-O: Running pass: CrossDSOCFIPass ; CHECK-O-NEXT: Running pass: OpenMPOptPass ; CHECK-O-NEXT: Running pass: GlobalDCEPass -; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Module ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis diff --git a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll index def42f91a34e0..e99250d768aa5 100644 --- a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll @@ -36,11 +36,10 @@ ; Suppress FileCheck --allow-unused-prefixes=false diagnostics. ; CHECK-NOEXT: {{^}} -; CHECK-O: Running pass: ForceFunctionAttrsPass -; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass -; CHECK-DIS-NEXT: Running analysis: InnerAnalysisManagerProxy +; CHECK-EP-PIPELINE-START: Running pass: NoOpModulePass +; CHECK-DIS: Running analysis: InnerAnalysisManagerProxy ; CHECK-DIS-NEXT: Running pass: AddDiscriminatorsPass -; CHECK-POSTLINK-O-NEXT: Running pass: PGOIndirectCallPromotion +; CHECK-POSTLINK-O: Running pass: PGOIndirectCallPromotion ; CHECK-POSTLINK-O-NEXT: Running analysis: ProfileSummaryAnalysis ; CHECK-POSTLINK-O-NEXT: Running analysis: InnerAnalysisManagerProxy ; CHECK-POSTLINK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis diff --git a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll index 8288a530e7299..e460b541ac5b1 100644 --- a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll @@ -23,9 +23,8 @@ ; Suppress FileCheck --allow-unused-prefixes=false diagnostics. ; CHECK-NOEXT: {{^}} -; CHECK-O: Running pass: ForceFunctionAttrsPass -; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass -; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion +; CHECK-EP-PIPELINE-START: Running pass: NoOpModulePass +; CHECK-O: Running pass:
[clang] 22a408a - [Pipelines] Don't explicitly require ORE
Author: Nikita Popov Date: 2023-04-21T13:22:04+02:00 New Revision: 22a408ae513c753f0b6a7a9b55fedf8fd735f1b1 URL: https://github.com/llvm/llvm-project/commit/22a408ae513c753f0b6a7a9b55fedf8fd735f1b1 DIFF: https://github.com/llvm/llvm-project/commit/22a408ae513c753f0b6a7a9b55fedf8fd735f1b1.diff LOG: [Pipelines] Don't explicitly require ORE LICM does not use ORE from the pass manager, it constructs its own instance. As such, explicitly requiring the analysis in the pipeline is unnecessary. Added: Modified: clang/test/CodeGen/thinlto-distributed-newpm.ll llvm/lib/Passes/PassBuilderPipelines.cpp llvm/test/Other/new-pm-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll Removed: diff --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll b/clang/test/CodeGen/thinlto-distributed-newpm.ll index 071e076a6a0d3..57e2011f55aed 100644 --- a/clang/test/CodeGen/thinlto-distributed-newpm.ll +++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll @@ -51,7 +51,6 @@ ; CHECK-O: Running pass: TailCallElimPass on main ; CHECK-O: Running pass: SimplifyCFGPass on main ; CHECK-O: Running pass: ReassociatePass on main -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis ; CHECK-O: Running pass: LoopSimplifyPass on main ; CHECK-O: Running pass: LCSSAPass on main ; CHECK-O: Running pass: SimplifyCFGPass on main @@ -96,7 +95,6 @@ ; CHECK-O: Running pass: LoopUnrollPass on main ; CHECK-O: Running pass: WarnMissedTransformationsPass on main ; CHECK-O: Running pass: InstCombinePass on main -; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}OptimizationRemarkEmitterAnalysis ; CHECK-O: Running pass: LoopSimplifyPass on main ; CHECK-O: Running pass: LCSSAPass on main ; CHECK-O: Running pass: LICMPass on b diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index da72bedf70582..4fa7326b24719 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -20,7 +20,6 @@ #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/InlineAdvisor.h" -#include "llvm/Analysis/OptimizationRemarkEmitter.h" #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/ScopedNoAliasAA.h" #include "llvm/Analysis/TypeBasedAliasAnalysis.h" @@ -459,10 +458,6 @@ PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level, invokeLoopOptimizerEndEPCallbacks(LPM2, Level); - // We provide the opt remark emitter pass for LICM to use. We only need to do - // this once as it is immutable. - FPM.addPass( - RequireAnalysisPass()); FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM1), /*UseMemorySSA=*/true, /*UseBlockFrequencyInfo=*/true)); @@ -642,10 +637,6 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level, invokeLoopOptimizerEndEPCallbacks(LPM2, Level); - // We provide the opt remark emitter pass for LICM to use. We only need to do - // this once as it is immutable. - FPM.addPass( - RequireAnalysisPass()); FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM1), /*UseMemorySSA=*/true, /*UseBlockFrequencyInfo=*/true)); @@ -1186,8 +1177,6 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level, /*AllowSpeculation=*/true)); LPM.addPass(SimpleLoopUnswitchPass(/* NonTrivial */ Level == OptimizationLevel::O3)); -ExtraPasses.addPass( -RequireAnalysisPass()); ExtraPasses.addPass( createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA=*/true, /*UseBlockFrequencyInfo=*/true)); @@ -1255,8 +1244,6 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level, // the CFG mess this may created if allowed to modify CFG, so forbid that. FPM.addPass(SROAPass(SROAOptions::PreserveCFG)); FPM.addPass(InstCombinePass()); -FPM.addPass( -RequireAnalysisPass()); FPM.addPass(createFunctionToLoopPassAdaptor( LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap, /*AllowSpeculation=*/true), diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll index 0cf856852f20b..c4e32e6878d26 100644 --- a/llvm/test/Other/new-pm-defaults.ll +++
[clang] 62ef97e - [llvm-c] Remove PassRegistry and initialization APIs
Author: Nikita Popov Date: 2023-04-14T12:12:48+02:00 New Revision: 62ef97e0631ff41ad53436477cecc7d3eb244d1b URL: https://github.com/llvm/llvm-project/commit/62ef97e0631ff41ad53436477cecc7d3eb244d1b DIFF: https://github.com/llvm/llvm-project/commit/62ef97e0631ff41ad53436477cecc7d3eb244d1b.diff LOG: [llvm-c] Remove PassRegistry and initialization APIs Remove C APIs for interacting with PassRegistry and pass initialization. These are legacy PM concepts, and are no longer relevant for the new pass manager. Calls to these initialization functions can simply be dropped. Differential Revision: https://reviews.llvm.org/D145043 Added: Modified: clang/docs/tools/clang-formatted-files.txt llvm/bindings/python/llvm/core.py llvm/docs/ReleaseNotes.rst llvm/include/llvm-c/Core.h llvm/include/llvm-c/Types.h llvm/include/llvm/PassRegistry.h llvm/lib/Analysis/Analysis.cpp llvm/lib/CodeGen/CodeGen.cpp llvm/lib/IR/Core.cpp llvm/lib/Target/Target.cpp llvm/lib/Transforms/IPO/IPO.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Instrumentation/Instrumentation.cpp llvm/lib/Transforms/Scalar/Scalar.cpp llvm/lib/Transforms/Utils/Utils.cpp llvm/lib/Transforms/Vectorize/Vectorize.cpp llvm/tools/llvm-c-test/include-all.c llvm/tools/llvm-c-test/main.c Removed: llvm/include/llvm-c/Initialization.h diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt index f48921d9f878a..004722d998f7b 100644 --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -5707,7 +5707,6 @@ llvm/include/llvm-c/Comdat.h llvm/include/llvm-c/Error.h llvm/include/llvm-c/ErrorHandling.h llvm/include/llvm-c/ExternC.h -llvm/include/llvm-c/Initialization.h llvm/include/llvm-c/IRReader.h llvm/include/llvm-c/LLJIT.h llvm/include/llvm-c/OrcEE.h diff --git a/llvm/bindings/python/llvm/core.py b/llvm/bindings/python/llvm/core.py index a0f8cf56c9637..812d5d0e94129 100644 --- a/llvm/bindings/python/llvm/core.py +++ b/llvm/bindings/python/llvm/core.py @@ -31,7 +31,6 @@ "BasicBlock", "Instruction", "Context", -"PassRegistry" ] lib = get_library() @@ -440,49 +439,11 @@ def __init__(self, context=None): def GetGlobalContext(cls): return Context(lib.LLVMGetGlobalContext()) -class PassRegistry(LLVMObject): -"""Represents an opaque pass registry object.""" - -def __init__(self): -LLVMObject.__init__(self, -lib.LLVMGetGlobalPassRegistry()) - def register_library(library): # Initialization/Shutdown declarations. -library.LLVMInitializeCore.argtypes = [PassRegistry] -library.LLVMInitializeCore.restype = None - -library.LLVMInitializeTransformUtils.argtypes = [PassRegistry] -library.LLVMInitializeTransformUtils.restype = None - -library.LLVMInitializeScalarOpts.argtypes = [PassRegistry] -library.LLVMInitializeScalarOpts.restype = None - -library.LLVMInitializeVectorization.argtypes = [PassRegistry] -library.LLVMInitializeVectorization.restype = None - -library.LLVMInitializeInstCombine.argtypes = [PassRegistry] -library.LLVMInitializeInstCombine.restype = None - -library.LLVMInitializeIPO.argtypes = [PassRegistry] -library.LLVMInitializeIPO.restype = None - -library.LLVMInitializeAnalysis.argtypes = [PassRegistry] -library.LLVMInitializeAnalysis.restype = None - -library.LLVMInitializeCodeGen.argtypes = [PassRegistry] -library.LLVMInitializeCodeGen.restype = None - -library.LLVMInitializeTarget.argtypes = [PassRegistry] -library.LLVMInitializeTarget.restype = None - library.LLVMShutdown.argtypes = [] library.LLVMShutdown.restype = None -# Pass Registry declarations. -library.LLVMGetGlobalPassRegistry.argtypes = [] -library.LLVMGetGlobalPassRegistry.restype = c_object_p - # Context declarations. library.LLVMContextCreate.argtypes = [] library.LLVMContextCreate.restype = c_object_p @@ -613,16 +574,6 @@ def register_enumerations(): def initialize_llvm(): Context.GetGlobalContext() -p = PassRegistry() -lib.LLVMInitializeCore(p) -lib.LLVMInitializeTransformUtils(p) -lib.LLVMInitializeScalarOpts(p) -lib.LLVMInitializeVectorization(p) -lib.LLVMInitializeInstCombine(p) -lib.LLVMInitializeIPO(p) -lib.LLVMInitializeAnalysis(p) -lib.LLVMInitializeCodeGen(p) -lib.LLVMInitializeTarget(p) register_library(lib) Enums = register_enumerations() diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index cd35844991301..451db539cfe66 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -191,6 +191,11 @@ Changes to the C API have been removed. * Removed ``LLVMPassManagerBuilderRef`` and functions interacting
[clang] 243e62b - [Coroutines] Directly remove unnecessary lifetime intrinsics
Author: Nikita Popov Date: 2023-04-14T10:22:30+02:00 New Revision: 243e62b9d8760cdf12cb2f0a0c49f41aa50b3b6f URL: https://github.com/llvm/llvm-project/commit/243e62b9d8760cdf12cb2f0a0c49f41aa50b3b6f DIFF: https://github.com/llvm/llvm-project/commit/243e62b9d8760cdf12cb2f0a0c49f41aa50b3b6f.diff LOG: [Coroutines] Directly remove unnecessary lifetime intrinsics The insertSpills() code will currently skip lifetime intrinsic users when replacing the alloca with a frame reference. Rather than leaving behind the dead lifetime intrinsics working on the old alloca, directly remove them. This makes sure the alloca can be dropped as well. I noticed this as a regression when converting tests to opaque pointers. Without opaque pointers, this code didn't really do anything, because there would usually be a bitcast in between. The lifetimes would get rewritten to the frame pointer. With opaque pointers, this code now triggers and leaves behind users of the old allocas. Differential Revision: https://reviews.llvm.org/D148240 Added: Modified: clang/test/CodeGenCoroutines/coro-always-inline.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll Removed: diff --git a/clang/test/CodeGenCoroutines/coro-always-inline.cpp b/clang/test/CodeGenCoroutines/coro-always-inline.cpp index 9ec3cb57d7a6..6e13a62fbd98 100644 --- a/clang/test/CodeGenCoroutines/coro-always-inline.cpp +++ b/clang/test/CodeGenCoroutines/coro-always-inline.cpp @@ -33,11 +33,8 @@ struct coroutine_traits { // CHECK-LABEL: @_Z3foov // CHECK-LABEL: entry: -// CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr %ref.tmp{{.*}}) -// CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr %ref.tmp{{.*}}) - -// CHECK: call void @llvm.lifetime.start.p0(i64 1, ptr %ref.tmp{{.*}}) -// CHECK: call void @llvm.lifetime.end.p0(i64 1, ptr %ref.tmp{{.*}}) +// CHECK: %ref.tmp.reload.addr = getelementptr +// CHECK: %ref.tmp4.reload.addr = getelementptr void foo() { co_return; } // Check that bar is not inlined even it's marked as always_inline. diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index d5a2275d1252..90fe01ae67c5 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1946,11 +1946,13 @@ static void insertSpills(const FrameDataInfo , coro::Shape ) { DVI->replaceUsesOfWith(Alloca, G); for (Instruction *I : UsersToUpdate) { - // It is meaningless to remain the lifetime intrinsics refer for the + // It is meaningless to retain the lifetime intrinsics refer for the // member of coroutine frames and the meaningless lifetime intrinsics // are possible to block further optimizations. - if (I->isLifetimeStartOrEnd()) + if (I->isLifetimeStartOrEnd()) { +I->eraseFromParent(); continue; + } I->replaceUsesOfWith(Alloca, G); } diff --git a/llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll b/llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll index 2d5212002c85..ffdd0ab66359 100644 --- a/llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll +++ b/llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll @@ -7,7 +7,6 @@ define void @foo() presplitcoroutine { ; CHECK-LABEL: @foo( ; CHECK-NEXT: entry: -; CHECK-NEXT:[[STACKVAR0:%.*]] = alloca i64, align 8 ; CHECK-NEXT:[[ID:%.*]] = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr @foo.resumers) ; CHECK-NEXT:[[ALLOC:%.*]] = call ptr @malloc(i64 40) ; CHECK-NEXT:[[VFRAME:%.*]] = call noalias nonnull ptr @llvm.coro.begin(token [[ID]], ptr [[ALLOC]]) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8c8b4d2 - [Clang] Update test checks (NFC)
Author: Nikita Popov Date: 2023-04-03T16:33:34+02:00 New Revision: 8c8b4d24f019e51900f15e008b52a05cf1e66381 URL: https://github.com/llvm/llvm-project/commit/8c8b4d24f019e51900f15e008b52a05cf1e66381 DIFF: https://github.com/llvm/llvm-project/commit/8c8b4d24f019e51900f15e008b52a05cf1e66381.diff LOG: [Clang] Update test checks (NFC) These were affected by 9b5ff4436e446e9df97ee37b3bcf9ba029c7d9aa. Added: Modified: clang/test/OpenMP/bug54082.c Removed: diff --git a/clang/test/OpenMP/bug54082.c b/clang/test/OpenMP/bug54082.c index 64702017dcde6..beaebeb21cb77 100644 --- a/clang/test/OpenMP/bug54082.c +++ b/clang/test/OpenMP/bug54082.c @@ -99,7 +99,7 @@ void foo() { // CHECK-NEXT:[[CONV:%.*]] = inttoptr i64 [[TMP1]] to ptr // CHECK-NEXT:[[DOTX__VOID_ADDR:%.*]] = tail call ptr @__kmpc_alloc(i32 [[TMP0]], i64 8, ptr [[CONV]]) // CHECK-NEXT:call void @__kmpc_for_static_init_4(ptr nonnull @[[GLOB1:[0-9]+]], i32 [[TMP0]], i32 34, ptr nonnull [[DOTOMP_IS_LAST]], ptr nonnull [[DOTOMP_LB]], ptr nonnull [[DOTOMP_UB]], ptr nonnull [[DOTOMP_STRIDE]], i32 1, i32 1) -// CHECK-NEXT:[[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !tbaa [[TBAA6]] +// CHECK-NEXT:[[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4 // CHECK-NEXT:[[COND:%.*]] = call i32 @llvm.smin.i32(i32 [[TMP2]], i32 1023) // CHECK-NEXT:store i32 [[COND]], ptr [[DOTOMP_UB]], align 4, !tbaa [[TBAA6]] // CHECK-NEXT:call void @__kmpc_for_static_fini(ptr nonnull @[[GLOB1]], i32 [[TMP0]]) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a8f6b57 - [PassBuilder] Support O0 in default pipelines
Author: Nikita Popov Date: 2023-03-17T10:00:05+01:00 New Revision: a8f6b5763e89cfeec94d3fcf0f6b70f96b293f7d URL: https://github.com/llvm/llvm-project/commit/a8f6b5763e89cfeec94d3fcf0f6b70f96b293f7d DIFF: https://github.com/llvm/llvm-project/commit/a8f6b5763e89cfeec94d3fcf0f6b70f96b293f7d.diff LOG: [PassBuilder] Support O0 in default pipelines The default and pre-link pipeline builders currently require you to call a separate method for optimization level O0, even though they have perfectly well-defined O0 optimization pipelines. Accept O0 optimization level and call buildO0DefaultPipeline() internally, so all consumers don't need to repeat this. Differential Revision: https://reviews.llvm.org/D146200 Added: Modified: clang/lib/CodeGen/BackendUtil.cpp clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp flang/lib/Frontend/FrontendActions.cpp llvm/include/llvm/Passes/PassBuilder.h llvm/lib/Passes/PassBuilder.cpp llvm/lib/Passes/PassBuilderPipelines.cpp mlir/lib/ExecutionEngine/OptUtils.cpp openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp Removed: diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 95da681eb3bc8..17d0d8d653ac6 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -973,9 +973,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline( MPM.addPass(InstrProfiling(*Options, false)); }); -if (CodeGenOpts.OptimizationLevel == 0) { - MPM = PB.buildO0DefaultPipeline(Level, IsLTO || IsThinLTO); -} else if (IsThinLTO) { +if (IsThinLTO) { MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level); } else if (IsLTO) { MPM = PB.buildLTOPreLinkDefaultPipeline(Level); diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp index de47cbf4b1ce3..bd3490e802e44 100644 --- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp +++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp @@ -103,11 +103,7 @@ static void RunOptimizationPasses(raw_ostream , Module , PB.registerLoopAnalyses(LAM); PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); - ModulePassManager MPM; - if (OL == OptimizationLevel::O0) -MPM = PB.buildO0DefaultPipeline(OL); - else -MPM = PB.buildPerModuleDefaultPipeline(OL); + ModulePassManager MPM = PB.buildPerModuleDefaultPipeline(OL); MPM.addPass(PrintModulePass(OS)); MPM.run(M, MAM); diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index 15c2b8b05688c..64cabd87e6a41 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -726,10 +726,7 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream ) { // Create the pass manager. llvm::ModulePassManager mpm; - if (opts.OptimizationLevel == 0) -mpm = pb.buildO0DefaultPipeline(level, opts.PrepareForFullLTO || - opts.PrepareForThinLTO); - else if (opts.PrepareForFullLTO) + if (opts.PrepareForFullLTO) mpm = pb.buildLTOPreLinkDefaultPipeline(level); else if (opts.PrepareForThinLTO) mpm = pb.buildThinLTOPreLinkDefaultPipeline(level); diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h index 9d9f256f1ceda..40413aad1281c 100644 --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -259,11 +259,6 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to fit well /// when IR coming into the LTO phase was first run through \c /// addPreLinkLTODefaultPipeline, and the two coordinate closely. - /// - /// Note that \p Level cannot be `O0` here. The pipelines produced are - /// only intended for use when attempting to optimize code. If frontends - /// require some transformations for semantic reasons, they should explicitly - /// build them. ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary); @@ -275,11 +270,6 @@ class PassBuilder { /// run. It works to minimize the IR which needs to be analyzed without /// making irreversible decisions which could be made better during the LTO /// run. - /// - /// Note that \p Level cannot be `O0` here. The pipelines produced are - /// only intended for use when attempting to optimize code. If frontends - /// require some transformations for semantic reasons, they should explicitly - /// build them. ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level); /// Build an LTO default optimization pipeline to a pass manager. @@ -288,11 +278,6 @@ class PassBuilder { /// optimization and code generation. It is particularly tuned to
[libunwind] 5d27638 - [libunwind][AArch64] Unbreak building with GNU assembler
Author: Xi Ruoyao Date: 2023-03-17T09:28:20+01:00 New Revision: 5d276380b0b45c3f02ef3c8614c3be95ce1bcb1e URL: https://github.com/llvm/llvm-project/commit/5d276380b0b45c3f02ef3c8614c3be95ce1bcb1e DIFF: https://github.com/llvm/llvm-project/commit/5d276380b0b45c3f02ef3c8614c3be95ce1bcb1e.diff LOG: [libunwind][AArch64] Unbreak building with GNU assembler GNU assembler mandates armv8.5-a for memtag instructions. Maybe we should remove this restriction in GNU assembler, but let's work around it for current GNU Binutils releases. Differential Revision: https://reviews.llvm.org/D146109 Added: Modified: libunwind/src/DwarfInstructions.hpp Removed: diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp index 27432be56133b..9962c2ffa0ca3 100644 --- a/libunwind/src/DwarfInstructions.hpp +++ b/libunwind/src/DwarfInstructions.hpp @@ -224,7 +224,8 @@ int DwarfInstructions::stepWithDwarf(A , pint_t pc, p &= ~0xfULL; // CFA is the bottom of the current stack frame. for (; p < cfa; p += 16) { - __asm__ __volatile__(".arch_extension memtag\n" + __asm__ __volatile__(".arch armv8.5-a\n" + ".arch_extension memtag\n" "stg %[Ptr], [%[Ptr]]\n" : : [Ptr] "r"(p) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ecf6508 - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-03-10T15:17:28+01:00 New Revision: ecf65087eee7529936c9c93d76e02b06816ba930 URL: https://github.com/llvm/llvm-project/commit/ecf65087eee7529936c9c93d76e02b06816ba930 DIFF: https://github.com/llvm/llvm-project/commit/ecf65087eee7529936c9c93d76e02b06816ba930.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/Modules/codegen-opt.test clang/test/Modules/codegen.test clang/test/Modules/initializers.cpp clang/test/Modules/objc-initializer.m Removed: diff --git a/clang/test/Modules/codegen-opt.test b/clang/test/Modules/codegen-opt.test index 6536611bd307..eafd47ae1ee3 100644 --- a/clang/test/Modules/codegen-opt.test +++ b/clang/test/Modules/codegen-opt.test @@ -1,16 +1,16 @@ RUN: rm -rf %t REQUIRES: x86-registered-target -RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen-opt/foo.modulemap -o %t/foo.pcm -RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=bar %S/Inputs/codegen-opt/bar.modulemap -o %t/bar.pcm -fmodule-file=%t/foo.pcm +RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=foo %S/Inputs/codegen-opt/foo.modulemap -o %t/foo.pcm +RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++ -fmodules -emit-module -fmodule-name=bar %S/Inputs/codegen-opt/bar.modulemap -o %t/bar.pcm -fmodule-file=%t/foo.pcm -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - %t/foo.pcm | FileCheck --check-prefix=FOO %s -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - %t/bar.pcm -fmodule-file=%t/foo.pcm | FileCheck --check-prefix=BAR-CMN --check-prefix=BAR %s -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -fmodules -fmodule-file=%t/foo.pcm -fmodule-file=%t/bar.pcm %S/Inputs/codegen-opt/use.cpp | FileCheck --check-prefix=USE-CMN --check-prefix=USE %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %t/foo.pcm | FileCheck --check-prefix=FOO %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %t/bar.pcm -fmodule-file=%t/foo.pcm | FileCheck --check-prefix=BAR-CMN --check-prefix=BAR %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - -fmodules -fmodule-file=%t/foo.pcm -fmodule-file=%t/bar.pcm %S/Inputs/codegen-opt/use.cpp | FileCheck --check-prefix=USE-CMN --check-prefix=USE %s -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes %t/foo.pcm | FileCheck --check-prefix=FOO %s -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes %t/bar.pcm -fmodule-file=%t/foo.pcm | FileCheck --check-prefix=BAR-CMN --check-prefix=BAR-OPT %s -RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes -fmodules -fmodule-file=%t/foo.pcm -fmodule-file=%t/bar.pcm %S/Inputs/codegen-opt/use.cpp | FileCheck --check-prefix=USE-CMN --check-prefix=USE-OPT %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes %t/foo.pcm | FileCheck --check-prefix=FOO %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes %t/bar.pcm -fmodule-file=%t/foo.pcm | FileCheck --check-prefix=BAR-CMN --check-prefix=BAR-OPT %s +RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - -O2 -disable-llvm-passes -fmodules -fmodule-file=%t/foo.pcm -fmodule-file=%t/bar.pcm %S/Inputs/codegen-opt/use.cpp | FileCheck --check-prefix=USE-CMN --check-prefix=USE-OPT %s FOO-NOT: comdat FOO: $_Z3foov = comdat any @@ -22,7 +22,7 @@ FOO: define{{.*}} void @_Z7foo_extv() FOO-NOT: {{define|declare}} FOO: define weak_odr void @_Z3foov() #{{[0-9]+}} comdat FOO-NOT: {{define|declare}} -FOO: declare void @_Z2f1Ri(i32* +FOO: declare void @_Z2f1Ri(ptr FOO-NOT: {{define|declare}} Internal functions are not modularly code generated - they are @@ -49,7 +49,7 @@ BAR: declare void @_Z3foov() Include all the available_externally definitions required for bar (foo -> f2) BAR-OPT: define available_externally void @_Z3foov() BAR-CMN-NOT: {{define|declare}} -BAR-OPT: declare void @_Z2f1Ri(i32* +BAR-OPT: declare void @_Z2f1Ri(ptr BAR-OPT-NOT: {{define|declare}} BAR-OPT: define internal void @_ZL2f2v() BAR-OPT-NOT: {{define|declare}} @@ -65,7 +65,7 @@ USE-OPT: define available_externally void @_Z3barv() USE-CMN-NOT: {{define|declare}} USE-OPT: define available_externally void @_Z3foov() USE-OPT-NOT: {{define|declare}} -USE-OPT: declare void @_Z2f1Ri(i32* +USE-OPT: declare void @_Z2f1Ri(ptr USE-OPT-NOT: {{define|declare}} USE-OPT: define internal void @_ZL2f2v() USE-OPT-NOT: {{define|declare}} diff --git a/clang/test/Modules/codegen.test
[clang] 6836714 - Revert "[clang-format] Add -j to clang-format-diff to speed up formatting"
Author: Nikita Popov Date: 2023-03-09T12:32:10+01:00 New Revision: 68367141dd91ee71f50418f28ea358519cd6613d URL: https://github.com/llvm/llvm-project/commit/68367141dd91ee71f50418f28ea358519cd6613d DIFF: https://github.com/llvm/llvm-project/commit/68367141dd91ee71f50418f28ea358519cd6613d.diff LOG: Revert "[clang-format] Add -j to clang-format-diff to speed up formatting" This reverts commit d14e7ee3d17cfa60d44256d742c10e9949a6048f. Makes clang_format_diff.py always fail with: Traceback (most recent call last): File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 177, in main() File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 174, in main process_subprocess_result(proc, args) File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 42, in process_subprocess_result with open(filename) as f: NameError: name 'filename' is not defined Added: Modified: clang/tools/clang-format/clang-format-diff.py Removed: diff --git a/clang/tools/clang-format/clang-format- diff .py b/clang/tools/clang-format/clang-format- diff .py index ce971e414e3d4..1dcc8689d5fef 100755 --- a/clang/tools/clang-format/clang-format- diff .py +++ b/clang/tools/clang-format/clang-format- diff .py @@ -34,21 +34,6 @@ else: from io import BytesIO as StringIO -def process_subprocess_result(proc, args): - stdout, stderr = proc.communicate() - if proc.returncode != 0: -sys.exit(proc.returncode) - if not args.i: -with open(filename) as f: - code = f.readlines() -formatted_code = StringIO(stdout).readlines() - diff = diff lib.unified_ diff (code, formatted_code, -filename, filename, -'(before formatting)', -'(after formatting)') - diff _string = ''.join( diff ) -if len( diff _string) > 0: - sys.stdout.write( diff _string) def main(): parser = argparse.ArgumentParser(description=__doc__, @@ -80,9 +65,6 @@ def main(): 'file to use.') parser.add_argument('-binary', default='clang-format', help='location of binary to use for clang-format') - parser.add_argument('-j', default=1, type=int, metavar='N', - help='number of concurrent clang-format processes to spawn in ' - 'parallel') args = parser.parse_args() # Extract changed lines for each file. @@ -124,54 +106,46 @@ def main(): ['-lines', str(start_line) + ':' + str(end_line)]) # Reformat files containing changes in place. - lbf = list(lines_by_file.items()) - procs = [None for i in range(args.j)] - while lbf: -spawned_one = False -for i, proc in enumerate(procs): - if not lbf: -break - if proc is not None and proc.poll() is not None: -process_subprocess_result(proc, args) -# Set to None to flag the slot as free to start a new process -procs[i] = None -proc = None - if proc is None: -filename, lines = lbf.pop() -spawned_one = True -if args.i and args.verbose: - print('Formatting {}'.format(filename)) -command = [args.binary, filename] -if args.i: - command.append('-i') -if args.sort_includes: - command.append('-sort-includes') -command.extend(lines) -if args.style: - command.extend(['-style', args.style]) -if args.fallback_style: - command.extend(['-fallback-style', args.fallback_style]) -try: - procs[i] = subprocess.Popen(command, - stdout=subprocess.PIPE, - stderr=None, - stdin=subprocess.PIPE, - universal_newlines=True) -except OSError as e: - # Give the user more context when clang-format isn't - # found/isn't executable, etc. - raise RuntimeError( - 'Failed to run "%s" - %s"' % (" ".join(command), e.strerror)) -# If we didn't spawn a single process after iterating through the whole -# list, wait on one of them to finish until we iterate through again, to -# prevent spinning in the case where we have a small number of jobs. -if not spawned_one: - procs[0].wait() - # Be sure not to leave any stray processes when exiting. - for proc in procs: -if proc: - proc.wait() - process_subprocess_result(proc, args) + for filename, lines in lines_by_file.items(): +if args.i and args.verbose: + print('Formatting {}'.format(filename)) +command = [args.binary, filename] +if args.i: + command.append('-i') +
[clang] fb30904 - [UTC] Enable --function-signature by default
Author: Nikita Popov Date: 2023-03-07T10:27:52+01:00 New Revision: fb309041f0c37fa2798305ae02cf6910bf0b402b URL: https://github.com/llvm/llvm-project/commit/fb309041f0c37fa2798305ae02cf6910bf0b402b DIFF: https://github.com/llvm/llvm-project/commit/fb309041f0c37fa2798305ae02cf6910bf0b402b.diff LOG: [UTC] Enable --function-signature by default This patch enables --function-signature by default under --version 2 and makes --version 2 the default. This means that all newly created tests will check the function signature, while leaving old tests alone. There's two motivations for this change: * Without --function-signature, the generated check lines may fail in a very hard to understand way if the test both includes a function definition and a call to that function. (Though we could address this by making the CHECK-LABEL stricter, without checking the full signature.) * This actually checks that uses of the arguments in the function body use the correct argument, instead of matching against any variable. This is a replacement for D139006 and D140212 based on the --version mechanism. I did not include an opt-out flag --no-function-signature because I'm not sure we need it. Would be happy to include it though, if desired. Differential Revision: https://reviews.llvm.org/D145149 Added: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.v2.expected Modified: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected clang/test/utils/update_cc_test_checks/mangled_names.test llvm/test/tools/UpdateTestChecks/update_test_checks/basic.test llvm/utils/UpdateTestChecks/common.py Removed: diff --git a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected index c70179fc21777..636f7af14d060 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected @@ -1,4 +1,4 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --version 2 +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 // Example input for update_cc_test_checks // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s diff --git a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected new file mode 100644 index 0..636f7af14d060 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected @@ -0,0 +1,43 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2 +// Example input for update_cc_test_checks +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: define dso_local i64 @test +// CHECK-SAME: (i64 noundef [[A:%.*]], i32 noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8 +// CHECK-NEXT:[[B_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:store i64 [[A]], ptr [[A_ADDR]], align 8 +// CHECK-NEXT:store i32 [[B]], ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = load i64, ptr [[A_ADDR]], align 8 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[CONV:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT:[[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] +// CHECK-NEXT:ret i64 [[ADD]] +// +long test(long a, int b) { + return a + b; +} + +// A function with a mangled name +// CHECK-LABEL: define dso_local i64 @_Z4testlii +// CHECK-SAME: (i64 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8 +// CHECK-NEXT:[[B_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:[[C_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:store i64 [[A]], ptr [[A_ADDR]], align 8 +// CHECK-NEXT:store i32 [[B]], ptr [[B_ADDR]], align 4 +// CHECK-NEXT:store i32 [[C]], ptr [[C_ADDR]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = load i64, ptr [[A_ADDR]], align 8 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[CONV:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT:[[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] +// CHECK-NEXT:[[TMP2:%.*]] = load i32, ptr [[C_ADDR]], align 4 +// CHECK-NEXT:[[CONV1:%.*]] = sext i32 [[TMP2]] to i64 +// CHECK-NEXT:[[ADD2:%.*]] = add nsw i64 [[ADD]], [[CONV1]] +// CHECK-NEXT:ret i64 [[ADD2]] +//
[clang] a26d303 - [UTC] Include return type/attributes under --version 2
Author: Nikita Popov Date: 2023-03-02T09:59:22+01:00 New Revision: a26d3031cf89954d030e494d47ca6653d531dc82 URL: https://github.com/llvm/llvm-project/commit/a26d3031cf89954d030e494d47ca6653d531dc82 DIFF: https://github.com/llvm/llvm-project/commit/a26d3031cf89954d030e494d47ca6653d531dc82.diff LOG: [UTC] Include return type/attributes under --version 2 If --function-signature is used with --version 2, then also include the return type/attributes in the check lines. This is the implementation of D133943 rebased on the --version mechanism from D142473. This doesn't bump the default version yet, because I'd like to do that together with D140212 (which enables --function-signature by default), as these changes seem closely related. For now this functionality can be accessed by explicitly passing --version 2 to UTC. Fixes https://github.com/llvm/llvm-project/issues/61058. Differential Revision: https://reviews.llvm.org/D144963 Added: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected Modified: clang/test/utils/update_cc_test_checks/mangled_names.test llvm/utils/UpdateTestChecks/asm.py llvm/utils/UpdateTestChecks/common.py llvm/utils/UpdateTestChecks/isel.py llvm/utils/update_cc_test_checks.py llvm/utils/update_test_checks.py Removed: diff --git a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected new file mode 100644 index 0..c70179fc21777 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected @@ -0,0 +1,43 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --version 2 +// Example input for update_cc_test_checks +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: define dso_local i64 @test +// CHECK-SAME: (i64 noundef [[A:%.*]], i32 noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8 +// CHECK-NEXT:[[B_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:store i64 [[A]], ptr [[A_ADDR]], align 8 +// CHECK-NEXT:store i32 [[B]], ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = load i64, ptr [[A_ADDR]], align 8 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[CONV:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT:[[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] +// CHECK-NEXT:ret i64 [[ADD]] +// +long test(long a, int b) { + return a + b; +} + +// A function with a mangled name +// CHECK-LABEL: define dso_local i64 @_Z4testlii +// CHECK-SAME: (i64 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca i64, align 8 +// CHECK-NEXT:[[B_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:[[C_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT:store i64 [[A]], ptr [[A_ADDR]], align 8 +// CHECK-NEXT:store i32 [[B]], ptr [[B_ADDR]], align 4 +// CHECK-NEXT:store i32 [[C]], ptr [[C_ADDR]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = load i64, ptr [[A_ADDR]], align 8 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[B_ADDR]], align 4 +// CHECK-NEXT:[[CONV:%.*]] = sext i32 [[TMP1]] to i64 +// CHECK-NEXT:[[ADD:%.*]] = add nsw i64 [[TMP0]], [[CONV]] +// CHECK-NEXT:[[TMP2:%.*]] = load i32, ptr [[C_ADDR]], align 4 +// CHECK-NEXT:[[CONV1:%.*]] = sext i32 [[TMP2]] to i64 +// CHECK-NEXT:[[ADD2:%.*]] = add nsw i64 [[ADD]], [[CONV1]] +// CHECK-NEXT:ret i64 [[ADD2]] +// +__attribute__((overloadable)) long test(long a, int b, int c) { + return a + b + c; +} diff --git a/clang/test/utils/update_cc_test_checks/mangled_names.test b/clang/test/utils/update_cc_test_checks/mangled_names.test index bc88c9b5a382f..40f8a5d78b521 100644 --- a/clang/test/utils/update_cc_test_checks/mangled_names.test +++ b/clang/test/utils/update_cc_test_checks/mangled_names.test @@ -16,3 +16,6 @@ # RUN: grep -v UTC_ARGS %t.c > %t-no-args.c # RUN: %update_cc_test_checks %t-no-args.c # RUN: diff -u %t-no-args.c %S/Inputs/mangled_names.c.expected +## Also try --version 2 +# RUN: %update_cc_test_checks %t.c --function-signature --version 2 +# RUN: diff -u %t.c %S/Inputs/mangled_names.c.funcsig.v2.expected diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py index e24197f3b63bb..697d3ee17d96f 100644 --- a/llvm/utils/UpdateTestChecks/asm.py +++ b/llvm/utils/UpdateTestChecks/asm.py @@ -534,7 +534,7 @@ def get_run_handler(triple): def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, global_vars_seen_dict, is_filtered): # Label format is based on ASM string. - check_label_format =
[clang] f7ca013 - [llvm-c] Remove bindings for creating legacy passes
Author: Nikita Popov Date: 2023-03-02T09:53:50+01:00 New Revision: f7ca01333214f934c580c162afdee933e7430b6c URL: https://github.com/llvm/llvm-project/commit/f7ca01333214f934c580c162afdee933e7430b6c DIFF: https://github.com/llvm/llvm-project/commit/f7ca01333214f934c580c162afdee933e7430b6c.diff LOG: [llvm-c] Remove bindings for creating legacy passes Legacy passes are only supported for codegen, and I don't believe it's possible to write backends using the C API, so we should drop all of those. Reduces the number of places that need to be modified when removing legacy passes. Differential Revision: https://reviews.llvm.org/D144970 Added: Modified: clang/docs/tools/clang-formatted-files.txt llvm/docs/ReleaseNotes.rst llvm/lib/Transforms/IPO/IPO.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp llvm/lib/Transforms/Scalar/Scalar.cpp llvm/lib/Transforms/Utils/Utils.cpp llvm/lib/Transforms/Vectorize/Vectorize.cpp llvm/tools/llvm-c-test/include-all.c Removed: llvm/include/llvm-c/Transforms/IPO.h llvm/include/llvm-c/Transforms/InstCombine.h llvm/include/llvm-c/Transforms/Scalar.h llvm/include/llvm-c/Transforms/Utils.h llvm/include/llvm-c/Transforms/Vectorize.h diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt index 45970232d0c0f..31d1dd7f365a2 100644 --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -5713,8 +5713,6 @@ llvm/include/llvm-c/OrcEE.h llvm/include/llvm-c/Remarks.h llvm/include/llvm-c/Types.h llvm/include/llvm-c/Transforms/PassBuilder.h -llvm/include/llvm-c/Transforms/Scalar.h -llvm/include/llvm-c/Transforms/Vectorize.h llvm/lib/Analysis/CodeMetrics.cpp llvm/lib/Analysis/CycleAnalysis.cpp llvm/lib/Analysis/DDGPrinter.cpp diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index ef7dacd82bf07..aed1df36b4901 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -145,6 +145,8 @@ Changes to the C API * ``LLVMContextSetOpaquePointers``, a temporary API to pin to legacy typed pointer, has been removed. +* Functions for adding legacy passes like ``LLVMAddInstructionCombiningPass`` + have been removed. Changes to the FastISel infrastructure -- diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h deleted file mode 100644 index c558aa37f1c3d..0 --- a/llvm/include/llvm-c/Transforms/IPO.h +++ /dev/null @@ -1,45 +0,0 @@ -/*===-- IPO.h - Interprocedural Transformations C Interface -*- C++ -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See https://llvm.org/LICENSE.txt for license information. *| -|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| -|* *| -|*===--===*| -|* *| -|* This header declares the C interface to libLLVMIPO.a, which implements *| -|* various interprocedural transformations of the LLVM IR. *| -|* *| -\*===--===*/ - -#ifndef LLVM_C_TRANSFORMS_IPO_H -#define LLVM_C_TRANSFORMS_IPO_H - -#include "llvm-c/ExternC.h" -#include "llvm-c/Types.h" - -LLVM_C_EXTERN_C_BEGIN - -/** - * @defgroup LLVMCTransformsIPO Interprocedural transformations - * @ingroup LLVMCTransforms - * - * @{ - */ - -/** See llvm::createDeadArgEliminationPass function. */ -void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM); - -/** See llvm::createFunctionAttrsPass function. */ -void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM); - -/** See llvm::createAlwaysInlinerPass function. */ -void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM); - -/** - * @} - */ - -LLVM_C_EXTERN_C_END - -#endif diff --git a/llvm/include/llvm-c/Transforms/InstCombine.h b/llvm/include/llvm-c/Transforms/InstCombine.h deleted file mode 100644 index ebe17d667061e..0 --- a/llvm/include/llvm-c/Transforms/InstCombine.h +++ /dev/null @@ -1,40 +0,0 @@ -/*===-- Scalar.h - Scalar Transformation Library C Interface *- C++ -*-===*\ -|* *| -|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| -|* Exceptions. *| -|* See
[clang] 26202a5 - [CGProfile] Don't fetch BFI without profile (NFCI)
Author: Nikita Popov Date: 2023-02-28T15:23:07+01:00 New Revision: 26202a57e5e78b5473ef657737d181f0a68ed56d URL: https://github.com/llvm/llvm-project/commit/26202a57e5e78b5473ef657737d181f0a68ed56d DIFF: https://github.com/llvm/llvm-project/commit/26202a57e5e78b5473ef657737d181f0a68ed56d.diff LOG: [CGProfile] Don't fetch BFI without profile (NFCI) Don't fetch BFI if the function has no entry count. Peculiarly, the implementation was already doing this for the (no longer existing) legacy PM implementation, but the same principle applies to the new pass manager. The only reason why the new PM doesn't have LazyBFI is that with the new pass manager all passes are lazy. This improves compile-time for non-PGO builds. Added: Modified: clang/test/CodeGen/sanitizer-module-constructor.c llvm/lib/Transforms/Instrumentation/CGProfile.cpp llvm/test/Other/new-pm-defaults.ll llvm/test/Other/new-pm-lto-defaults.ll llvm/test/Other/new-pm-thinlto-defaults.ll Removed: diff --git a/clang/test/CodeGen/sanitizer-module-constructor.c b/clang/test/CodeGen/sanitizer-module-constructor.c index abc579c6fe23d..e4d08cde2620a 100644 --- a/clang/test/CodeGen/sanitizer-module-constructor.c +++ b/clang/test/CodeGen/sanitizer-module-constructor.c @@ -18,4 +18,4 @@ void h(void) { f(e); } // CHECK: Running pass: {{.*}}SanitizerPass // CHECK-NOT: Running pass: LoopSimplifyPass on {{.*}}san.module_ctor -// CHECK: Running analysis: DominatorTreeAnalysis on {{.*}}san.module_ctor +// CHECK: Running analysis: TargetLibraryAnalysis on {{.*}}san.module_ctor diff --git a/llvm/lib/Transforms/Instrumentation/CGProfile.cpp b/llvm/lib/Transforms/Instrumentation/CGProfile.cpp index 638790eea9a35..391aae3f0495d 100644 --- a/llvm/lib/Transforms/Instrumentation/CGProfile.cpp +++ b/llvm/lib/Transforms/Instrumentation/CGProfile.cpp @@ -46,7 +46,7 @@ addModuleFlags(Module , } static bool runCGProfilePass( -Module , FunctionAnalysisManager , bool LazyBFI) { +Module , FunctionAnalysisManager ) { MapVector, uint64_t> Counts; InstrProfSymtab Symtab; auto UpdateCounts = [&](TargetTransformInfo , Function *F, @@ -63,10 +63,8 @@ static bool runCGProfilePass( (void)(bool) Symtab.create(M); for (auto : M) { // Avoid extra cost of running passes for BFI when the function doesn't have -// entry count. Since LazyBlockFrequencyInfoPass only exists in LPM, check -// if using LazyBlockFrequencyInfoPass. -// TODO: Remove LazyBFI when LazyBlockFrequencyInfoPass is available in NPM. -if (F.isDeclaration() || (LazyBFI && !F.getEntryCount())) +// entry count. +if (F.isDeclaration() || !F.getEntryCount()) continue; auto = FAM.getResult(F); if (BFI.getEntryFreq() == 0) @@ -104,7 +102,7 @@ static bool runCGProfilePass( PreservedAnalyses CGProfilePass::run(Module , ModuleAnalysisManager ) { FunctionAnalysisManager = MAM.getResult(M).getManager(); - runCGProfilePass(M, FAM, false); + runCGProfilePass(M, FAM); return PreservedAnalyses::all(); } diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll index 9158ed54b3003..8b2bc4c84bcad 100644 --- a/llvm/test/Other/new-pm-defaults.ll +++ b/llvm/test/Other/new-pm-defaults.ll @@ -274,8 +274,6 @@ ; CHECK-O-NEXT: Running pass: GlobalDCEPass ; CHECK-O-NEXT: Running pass: ConstantMergePass ; CHECK-DEFAULT-NEXT: Running pass: CGProfilePass -; CHECK-DEFAULT-NEXT: Running analysis: BlockFrequencyAnalysis -; CHECK-DEFAULT-NEXT: Running analysis: BranchProbabilityAnalysis ; CHECK-DEFAULT-NEXT: Running pass: RelLookupTableConverterPass ; CHECK-LTO-NOT: Running pass: RelLookupTableConverterPass ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo diff --git a/llvm/test/Other/new-pm-lto-defaults.ll b/llvm/test/Other/new-pm-lto-defaults.ll index ee570015008e1..f93a39b9578c1 100644 --- a/llvm/test/Other/new-pm-lto-defaults.ll +++ b/llvm/test/Other/new-pm-lto-defaults.ll @@ -140,8 +140,6 @@ ; CHECK-O23SZ-NEXT: Running pass: EliminateAvailableExternallyPass ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass ; CHECK-O23SZ-NEXT: Running pass: CGProfilePass -; CHECK-O23SZ-NEXT: Running analysis: BlockFrequencyAnalysis on foo -; CHECK-O23SZ-NEXT: Running analysis: BranchProbabilityAnalysis on foo ; CHECK-EP-NEXT: Running pass: NoOpModulePass ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo ; CHECK-O-NEXT: Running pass: PrintModulePass diff --git a/llvm/test/Other/new-pm-thinlto-defaults.ll b/llvm/test/Other/new-pm-thinlto-defaults.ll index 22585aa8ce652..6d73544b191c0 100644 --- a/llvm/test/Other/new-pm-thinlto-defaults.ll +++ b/llvm/test/Other/new-pm-thinlto-defaults.ll @@ -236,8 +236,6 @@ ; CHECK-POSTLINK-O-NEXT: Running pass: GlobalDCEPass ; CHECK-POSTLINK-O-NEXT: Running pass: ConstantMergePass ; CHECK-POSTLINK-O-NEXT: Running pass: CGProfilePass -;
[clang] f332498 - [Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas
Author: Deniz Evrenci Date: 2023-02-28T11:41:07+01:00 New Revision: f332498f9880d276890562fb861a375a13bfd9d9 URL: https://github.com/llvm/llvm-project/commit/f332498f9880d276890562fb861a375a13bfd9d9 DIFF: https://github.com/llvm/llvm-project/commit/f332498f9880d276890562fb861a375a13bfd9d9.diff LOG: [Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas All exceptions thrown in coroutine bodies are caught and unhandled_exception member of the coroutine promise type is called. In accordance with the existing rules of diagnostics related to exceptions thrown in functions marked noexcept, even if the promise type's constructor, get_return_object, or unhandled_exception throws, diagnostics should not be emitted. Fixes #48797. Differential Revision: https://reviews.llvm.org/D144352 Added: clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp Modified: clang/lib/Sema/AnalysisBasedWarnings.cpp Removed: diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 07e17f9f71072..436743564c258 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2509,7 +2509,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings( // Check for throw out of non-throwing function. if (!Diags.isIgnored(diag::warn_throw_in_noexcept_func, D->getBeginLoc())) if (const FunctionDecl *FD = dyn_cast(D)) - if (S.getLangOpts().CPlusPlus && isNoexcept(FD)) + if (S.getLangOpts().CPlusPlus && !fscope->isCoroutine() && isNoexcept(FD)) checkThrowInNonThrowingFunc(S, FD, AC); // Emit unsafe buffer usage warnings and fixits. diff --git a/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp b/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp new file mode 100644 index 0..4d52bdca7ca93 --- /dev/null +++ b/clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -std=c++20 %s -fcxx-exceptions -fsyntax-only -Wexceptions -verify -fdeclspec + +#include "Inputs/std-coroutine.h" + +// expected-no-diagnostics + +template +struct promise; + +template +struct task { +using promise_type = promise; + +explicit task(promise_type& p) { throw 1; p.return_val = this; } + +task(const task&) = delete; + +T value; +}; + +template +struct promise { +task get_return_object() { return task{*this}; } + +std::suspend_never initial_suspend() const noexcept { return {}; } + +std::suspend_never final_suspend() const noexcept { return {}; } + +template +void return_value(U&& val) { return_val->value = static_cast(val); } + +void unhandled_exception() { throw 1; } + +task* return_val; +}; + +task a_ShouldNotDiag(const int a, const int b) { + if (b == 0) +throw b; + + co_return a / b; +} + +task b_ShouldNotDiag(const int a, const int b) noexcept { + if (b == 0) +throw b; + + co_return a / b; +} + +const auto c_ShouldNotDiag = [](const int a, const int b) -> task { + if (b == 0) +throw b; + + co_return a / b; +}; + +const auto d_ShouldNotDiag = [](const int a, const int b) noexcept -> task { + if (b == 0) +throw b; + + co_return a / b; +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 06621ec - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-02-17T15:08:50+01:00 New Revision: 06621ecdaf416d87968dcaf57a634c83cf0dc1b8 URL: https://github.com/llvm/llvm-project/commit/06621ecdaf416d87968dcaf57a634c83cf0dc1b8 DIFF: https://github.com/llvm/llvm-project/commit/06621ecdaf416d87968dcaf57a634c83cf0dc1b8.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGen/math-builtins.c clang/test/CodeGen/math-libcalls.c clang/test/CodeGen/mult-alt-generic.c clang/test/CodeGenCUDA/device-stub.cu clang/test/CodeGenCUDA/static-device-var-rdc.cu clang/test/CodeGenCXX/auto-var-init-stop-after.cpp Removed: diff --git a/clang/test/CodeGen/math-builtins.c b/clang/test/CodeGen/math-builtins.c index 559421a4882c5..04738cce01073 100644 --- a/clang/test/CodeGen/math-builtins.c +++ b/clang/test/CodeGen/math-builtins.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN // Test attributes and codegen of math builtins. @@ -52,14 +52,14 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { __builtin_frexp(f,i);__builtin_frexpf(f,i); __builtin_frexpl(f,i); __builtin_frexpf128(f,i); -// NO__ERRNO: declare double @frexp(double noundef, i32* noundef) [[NOT_READNONE:#[0-9]+]] -// NO__ERRNO: declare float @frexpf(float noundef, i32* noundef) [[NOT_READNONE]] -// NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, i32* noundef) [[NOT_READNONE]] -// NO__ERRNO: declare fp128 @frexpf128(fp128 noundef, i32* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare double @frexp(double noundef, i32* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare float @frexpf(float noundef, i32* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, i32* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare fp128 @frexpf128(fp128 noundef, i32* noundef) [[NOT_READNONE]] +// NO__ERRNO: declare double @frexp(double noundef, ptr noundef) [[NOT_READNONE:#[0-9]+]] +// NO__ERRNO: declare float @frexpf(float noundef, ptr noundef) [[NOT_READNONE]] +// NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]] +// NO__ERRNO: declare fp128 @frexpf128(fp128 noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare double @frexp(double noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare float @frexpf(float noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare fp128 @frexpf128(fp128 noundef, ptr noundef) [[NOT_READNONE]] __builtin_huge_val();__builtin_huge_valf(); __builtin_huge_vall(); __builtin_huge_valf128(); @@ -88,36 +88,36 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { __builtin_modf(f,d); __builtin_modff(f,fp); __builtin_modfl(f,l); __builtin_modff128(f,l); -// NO__ERRNO: declare double @modf(double noundef, double* noundef) [[NOT_READNONE]] -// NO__ERRNO: declare float @modff(float noundef, float* noundef) [[NOT_READNONE]] -// NO__ERRNO: declare x86_fp80 @modfl(x86_fp80 noundef, x86_fp80* noundef) [[NOT_READNONE]] -// NO__ERRNO: declare fp128 @modff128(fp128 noundef, fp128* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare double @modf(double noundef, double* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare float @modff(float noundef, float* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare x86_fp80 @modfl(x86_fp80 noundef, x86_fp80* noundef) [[NOT_READNONE]] -// HAS_ERRNO: declare fp128 @modff128(fp128 noundef, fp128* noundef) [[NOT_READNONE]] +// NO__ERRNO: declare double @modf(double noundef, ptr noundef) [[NOT_READNONE]] +// NO__ERRNO: declare float @modff(float noundef, ptr noundef) [[NOT_READNONE]] +// NO__ERRNO: declare
[clang] f3fa108 - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-02-17T11:56:00+01:00 New Revision: f3fa1086c7f83edcc473724a8ac7d675a9df11d7 URL: https://github.com/llvm/llvm-project/commit/f3fa1086c7f83edcc473724a8ac7d675a9df11d7 DIFF: https://github.com/llvm/llvm-project/commit/f3fa1086c7f83edcc473724a8ac7d675a9df11d7.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGen/arm64-microsoft-arguments.cpp clang/test/CodeGen/atomic-ops-libcall.c clang/test/CodeGen/atomic-ops.c clang/test/CodeGen/attr-nomerge.cpp clang/test/CodeGen/attr-target-mv-va-args.c clang/test/CodeGen/big-atomic-ops.c clang/test/CodeGen/blocks.c clang/test/CodeGen/bpf-attr-preserve-access-index-1.c clang/test/CodeGen/bpf-attr-preserve-access-index-2.c clang/test/CodeGen/builtin-preserve-access-index-array.c clang/test/CodeGen/builtin-preserve-access-index-nonptr.c clang/test/CodeGen/builtin-preserve-access-index-typedef.c clang/test/CodeGen/builtin-preserve-access-index.c clang/test/CodeGen/builtins-bpf-preserve-field-info-1.c clang/test/CodeGen/builtins-bpf-preserve-field-info-2.c clang/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp Removed: diff --git a/clang/test/CodeGen/arm64-microsoft-arguments.cpp b/clang/test/CodeGen/arm64-microsoft-arguments.cpp index ca1ff2025b74..a9ae6911b16e 100644 --- a/clang/test/CodeGen/arm64-microsoft-arguments.cpp +++ b/clang/test/CodeGen/arm64-microsoft-arguments.cpp @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple aarch64-windows -ffreestanding -emit-llvm -O0 \ +// RUN: %clang_cc1 -triple aarch64-windows -ffreestanding -emit-llvm -O0 \ // RUN: -x c++ -o - %s | FileCheck %s // Pass and return for type size <= 8 bytes. // CHECK: define {{.*}} i64 @{{.*}}f1{{.*}}() -// CHECK: call i64 {{.*}}func1{{.*}}(i64 %3) +// CHECK: call i64 {{.*}}func1{{.*}}(i64 %0) struct S1 { int a[2]; }; @@ -16,7 +16,7 @@ S1 f1() { // Pass and return type size <= 16 bytes. // CHECK: define {{.*}} [2 x i64] @{{.*}}f2{{.*}}() -// CHECK: call [2 x i64] {{.*}}func2{{.*}}([2 x i64] %3) +// CHECK: call [2 x i64] {{.*}}func2{{.*}}([2 x i64] %0) struct S2 { int a[4]; }; @@ -28,8 +28,8 @@ S2 f2() { } // Pass and return for type size > 16 bytes. -// CHECK: define {{.*}} void @{{.*}}f3{{.*}}(%struct.S3* noalias sret(%struct.S3) align 4 %agg.result) -// CHECK: call void {{.*}}func3{{.*}}(%struct.S3* sret(%struct.S3) align 4 %agg.result, %struct.S3* noundef %agg.tmp) +// CHECK: define {{.*}} void @{{.*}}f3{{.*}}(ptr noalias sret(%struct.S3) align 4 %agg.result) +// CHECK: call void {{.*}}func3{{.*}}(ptr sret(%struct.S3) align 4 %agg.result, ptr noundef %agg.tmp) struct S3 { int a[5]; }; @@ -42,8 +42,8 @@ S3 f3() { // Pass and return aggregate (of size < 16 bytes) with non-trivial destructor. // Passed directly but returned indirectly. -// CHECK: define {{.*}} void {{.*}}f4{{.*}}(%struct.S4* inreg noalias sret(%struct.S4) align 4 %agg.result) -// CHECK: call void {{.*}}func4{{.*}}(%struct.S4* inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %5) +// CHECK: define {{.*}} void {{.*}}f4{{.*}}(ptr inreg noalias sret(%struct.S4) align 4 %agg.result) +// CHECK: call void {{.*}}func4{{.*}}(ptr inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %0) struct S4 { int a[3]; ~S4(); @@ -56,8 +56,8 @@ S4 f4() { } // Pass and return from instance method called from instance method. -// CHECK: define {{.*}} void @{{.*}}bar@Q1{{.*}}(%class.Q1* {{[^,]*}} %this, %class.P1* inreg noalias sret(%class.P1) align 1 %agg.result) -// CHECK: call void {{.*}}foo@P1{{.*}}(%class.P1* noundef{{[^,]*}} %ref.tmp, %class.P1* inreg sret(%class.P1) align 1 %agg.result, i8 %1) +// CHECK: define {{.*}} void @{{.*}}bar@Q1{{.*}}(ptr {{[^,]*}} %this, ptr inreg noalias sret(%class.P1) align 1 %agg.result) +// CHECK: call void {{.*}}foo@P1{{.*}}(ptr noundef{{[^,]*}} %ref.tmp, ptr inreg sret(%class.P1) align 1 %agg.result, i8 %0) class P1 { public: @@ -76,7 +76,7 @@ P1 Q1::bar() { // Pass and return from instance method called from free function. // CHECK: define {{.*}} void {{.*}}bar{{.*}}() -// CHECK: call void {{.*}}foo@P2{{.*}}(%class.P2* noundef{{[^,]*}} %ref.tmp, %class.P2* inreg sret(%class.P2) align 1 %retval, i8 %0) +// CHECK: call void {{.*}}foo@P2{{.*}}(ptr noundef{{[^,]*}} %ref.tmp, ptr inreg sret(%class.P2) align 1 %retval, i8 %0) class P2 { public: P2 foo(P2 x); @@ -89,8 +89,8 @@ P2 bar() { // Pass and return an object with a user-provided constructor (passed directly, // returned indirectly) -// CHECK: define {{.*}} void @{{.*}}f5{{.*}}(%struct.S5* inreg noalias sret(%struct.S5) align 4 %agg.result) -// CHECK: call void {{.*}}func5{{.*}}(%struct.S5* inreg sret(%struct.S5) align 4 %agg.result, i64 {{.*}}) +// CHECK: define {{.*}} void @{{.*}}f5{{.*}}(ptr inreg noalias sret(%struct.S5) align
[clang] 57c8191 - [Clang] Convert update_cc_test_checks tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-02-17T09:07:15+01:00 New Revision: 57c81917d3a596f925f1c072ad04425b66bbd80e URL: https://github.com/llvm/llvm-project/commit/57c81917d3a596f925f1c072ad04425b66bbd80e DIFF: https://github.com/llvm/llvm-project/commit/57c81917d3a596f925f1c072ad04425b66bbd80e.diff LOG: [Clang] Convert update_cc_test_checks tests to opaque pointers (NFC) Added: Modified: clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.plain.expected clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected Removed: diff --git a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp index d1931edb2e0aa..98be350b39377 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp +++ b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp @@ -1,5 +1,5 @@ // Basic C++ test for update_cc_test_checks -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s class Foo { int x; diff --git a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected index 6c7dd730e5439..c916e3395a91c 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected @@ -1,6 +1,6 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // Basic C++ test for update_cc_test_checks -// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s class Foo { int x; @@ -10,14 +10,14 @@ public: ~Foo(); // CHECK-LABEL: @_ZNK3Foo23function_defined_inlineEi( // CHECK-NEXT: entry: -// CHECK-NEXT:[[THIS_ADDR:%.*]] = alloca %class.Foo*, align 8 +// CHECK-NEXT:[[THIS_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT:[[ARG_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT:store %class.Foo* [[THIS:%.*]], %class.Foo** [[THIS_ADDR]], align 8 -// CHECK-NEXT:store i32 [[ARG:%.*]], i32* [[ARG_ADDR]], align 4 -// CHECK-NEXT:[[THIS1:%.*]] = load %class.Foo*, %class.Foo** [[THIS_ADDR]], align 8 -// CHECK-NEXT:[[TMP0:%.*]] = load i32, i32* [[ARG_ADDR]], align 4 -// CHECK-NEXT:[[X:%.*]] = getelementptr inbounds [[CLASS_FOO:%.*]], %class.Foo* [[THIS1]], i32 0, i32 0 -// CHECK-NEXT:[[TMP1:%.*]] = load i32, i32* [[X]], align 4 +// CHECK-NEXT:store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT:store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT:[[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT:[[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT:[[X:%.*]] = getelementptr inbounds [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[X]], align 4 // CHECK-NEXT:[[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]] // CHECK-NEXT:ret i32 [[ADD]] // @@ -29,35 +29,35 @@ public: // CHECK-LABEL: @_ZN3FooC1Ei( // CHECK-NEXT: entry: -// CHECK-NEXT:[[THIS_ADDR:%.*]] = alloca %class.Foo*,
[clang] eb3dfa0 - [Clang] Convert some tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-02-16T17:05:26+01:00 New Revision: eb3dfa0a248794cc51912705540f1ab1f4dde619 URL: https://github.com/llvm/llvm-project/commit/eb3dfa0a248794cc51912705540f1ab1f4dde619 DIFF: https://github.com/llvm/llvm-project/commit/eb3dfa0a248794cc51912705540f1ab1f4dde619.diff LOG: [Clang] Convert some tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGen/WebAssembly/wasm-varargs.c clang/test/CodeGen/X86/avx512fp16-builtins.c clang/test/CodeGen/X86/ms-x86-intrinsics.c clang/test/CodeGen/ms-intrinsics-other.c Removed: diff --git a/clang/test/CodeGen/WebAssembly/wasm-varargs.c b/clang/test/CodeGen/WebAssembly/wasm-varargs.c index 869ff4afe5c1..3c743692e094 100644 --- a/clang/test/CodeGen/WebAssembly/wasm-varargs.c +++ b/clang/test/CodeGen/WebAssembly/wasm-varargs.c @@ -1,26 +1,23 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature -// RUN: %clang_cc1 -no-opaque-pointers -triple wasm32-unknown-unknown -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -triple wasm32-unknown-unknown -o - -emit-llvm %s | FileCheck %s #include // CHECK-LABEL: define {{[^@]+}}@test_i32 -// CHECK-SAME: (i8* noundef [[FMT:%.*]], ...) #[[ATTR0:[0-9]+]] { +// CHECK-SAME: (ptr noundef [[FMT:%.*]], ...) #[[ATTR0:[0-9]+]] { // CHECK-NEXT: entry: -// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca i8*, align 4 -// CHECK-NEXT:[[VA:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca ptr, align 4 +// CHECK-NEXT:[[VA:%.*]] = alloca ptr, align 4 // CHECK-NEXT:[[V:%.*]] = alloca i32, align 4 -// CHECK-NEXT:store i8* [[FMT]], i8** [[FMT_ADDR]], align 4 -// CHECK-NEXT:[[VA1:%.*]] = bitcast i8** [[VA]] to i8* -// CHECK-NEXT:call void @llvm.va_start(i8* [[VA1]]) -// CHECK-NEXT:[[ARGP_CUR:%.*]] = load i8*, i8** [[VA]], align 4 -// CHECK-NEXT:[[ARGP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[ARGP_CUR]], i32 4 -// CHECK-NEXT:store i8* [[ARGP_NEXT]], i8** [[VA]], align 4 -// CHECK-NEXT:[[TMP0:%.*]] = bitcast i8* [[ARGP_CUR]] to i32* -// CHECK-NEXT:[[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 -// CHECK-NEXT:store i32 [[TMP1]], i32* [[V]], align 4 -// CHECK-NEXT:[[VA2:%.*]] = bitcast i8** [[VA]] to i8* -// CHECK-NEXT:call void @llvm.va_end(i8* [[VA2]]) -// CHECK-NEXT:[[TMP2:%.*]] = load i32, i32* [[V]], align 4 +// CHECK-NEXT:store ptr [[FMT]], ptr [[FMT_ADDR]], align 4 +// CHECK-NEXT:call void @llvm.va_start(ptr [[VA]]) +// CHECK-NEXT:[[ARGP_CUR:%.*]] = load ptr, ptr [[VA]], align 4 +// CHECK-NEXT:[[ARGP_NEXT:%.*]] = getelementptr inbounds i8, ptr [[ARGP_CUR]], i32 4 +// CHECK-NEXT:store ptr [[ARGP_NEXT]], ptr [[VA]], align 4 +// CHECK-NEXT:[[TMP1:%.*]] = load i32, ptr [[ARGP_CUR]], align 4 +// CHECK-NEXT:store i32 [[TMP1]], ptr [[V]], align 4 +// CHECK-NEXT:call void @llvm.va_end(ptr [[VA]]) +// CHECK-NEXT:[[TMP2:%.*]] = load i32, ptr [[V]], align 4 // CHECK-NEXT:ret i32 [[TMP2]] // int test_i32(char *fmt, ...) { @@ -35,27 +32,24 @@ int test_i32(char *fmt, ...) { // CHECK-LABEL: define {{[^@]+}}@test_i64 -// CHECK-SAME: (i8* noundef [[FMT:%.*]], ...) #[[ATTR0]] { +// CHECK-SAME: (ptr noundef [[FMT:%.*]], ...) #[[ATTR0]] { // CHECK-NEXT: entry: -// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca i8*, align 4 -// CHECK-NEXT:[[VA:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca ptr, align 4 +// CHECK-NEXT:[[VA:%.*]] = alloca ptr, align 4 // CHECK-NEXT:[[V:%.*]] = alloca i64, align 8 -// CHECK-NEXT:store i8* [[FMT]], i8** [[FMT_ADDR]], align 4 -// CHECK-NEXT:[[VA1:%.*]] = bitcast i8** [[VA]] to i8* -// CHECK-NEXT:call void @llvm.va_start(i8* [[VA1]]) -// CHECK-NEXT:[[ARGP_CUR:%.*]] = load i8*, i8** [[VA]], align 4 -// CHECK-NEXT:[[TMP0:%.*]] = ptrtoint i8* [[ARGP_CUR]] to i32 +// CHECK-NEXT:store ptr [[FMT]], ptr [[FMT_ADDR]], align 4 +// CHECK-NEXT:call void @llvm.va_start(ptr [[VA]]) +// CHECK-NEXT:[[ARGP_CUR:%.*]] = load ptr, ptr [[VA]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = ptrtoint ptr [[ARGP_CUR]] to i32 // CHECK-NEXT:[[TMP1:%.*]] = add i32 [[TMP0]], 7 // CHECK-NEXT:[[TMP2:%.*]] = and i32 [[TMP1]], -8 -// CHECK-NEXT:[[ARGP_CUR_ALIGNED:%.*]] = inttoptr i32 [[TMP2]] to i8* -// CHECK-NEXT:[[ARGP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[ARGP_CUR_ALIGNED]], i32 8 -// CHECK-NEXT:store i8* [[ARGP_NEXT]], i8** [[VA]], align 4 -// CHECK-NEXT:[[TMP3:%.*]] = bitcast i8* [[ARGP_CUR_ALIGNED]] to i64* -// CHECK-NEXT:[[TMP4:%.*]] = load i64, i64* [[TMP3]], align 8 -// CHECK-NEXT:store i64 [[TMP4]], i64* [[V]], align 8 -// CHECK-NEXT:[[VA2:%.*]] = bitcast i8** [[VA]] to i8* -// CHECK-NEXT:call void @llvm.va_end(i8* [[VA2]]) -// CHECK-NEXT:[[TMP5:%.*]] = load i64, i64* [[V]], align 8 +//
[clang] 081815b - [Clang] Regenerate check lines (NFC)
Author: Nikita Popov Date: 2023-02-16T17:05:25+01:00 New Revision: 081815b4e32cc57debe974ff89d61436f3bcec83 URL: https://github.com/llvm/llvm-project/commit/081815b4e32cc57debe974ff89d61436f3bcec83 DIFF: https://github.com/llvm/llvm-project/commit/081815b4e32cc57debe974ff89d61436f3bcec83.diff LOG: [Clang] Regenerate check lines (NFC) Convert test to use update_cc_test_checks. Added: Modified: clang/test/CodeGen/WebAssembly/wasm-varargs.c Removed: diff --git a/clang/test/CodeGen/WebAssembly/wasm-varargs.c b/clang/test/CodeGen/WebAssembly/wasm-varargs.c index 91840c296096..869ff4afe5c1 100644 --- a/clang/test/CodeGen/WebAssembly/wasm-varargs.c +++ b/clang/test/CodeGen/WebAssembly/wasm-varargs.c @@ -1,7 +1,28 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature // RUN: %clang_cc1 -no-opaque-pointers -triple wasm32-unknown-unknown -o - -emit-llvm %s | FileCheck %s #include +// CHECK-LABEL: define {{[^@]+}}@test_i32 +// CHECK-SAME: (i8* noundef [[FMT:%.*]], ...) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[VA:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[V:%.*]] = alloca i32, align 4 +// CHECK-NEXT:store i8* [[FMT]], i8** [[FMT_ADDR]], align 4 +// CHECK-NEXT:[[VA1:%.*]] = bitcast i8** [[VA]] to i8* +// CHECK-NEXT:call void @llvm.va_start(i8* [[VA1]]) +// CHECK-NEXT:[[ARGP_CUR:%.*]] = load i8*, i8** [[VA]], align 4 +// CHECK-NEXT:[[ARGP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[ARGP_CUR]], i32 4 +// CHECK-NEXT:store i8* [[ARGP_NEXT]], i8** [[VA]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = bitcast i8* [[ARGP_CUR]] to i32* +// CHECK-NEXT:[[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 +// CHECK-NEXT:store i32 [[TMP1]], i32* [[V]], align 4 +// CHECK-NEXT:[[VA2:%.*]] = bitcast i8** [[VA]] to i8* +// CHECK-NEXT:call void @llvm.va_end(i8* [[VA2]]) +// CHECK-NEXT:[[TMP2:%.*]] = load i32, i32* [[V]], align 4 +// CHECK-NEXT:ret i32 [[TMP2]] +// int test_i32(char *fmt, ...) { va_list va; @@ -12,25 +33,31 @@ int test_i32(char *fmt, ...) { return v; } -// CHECK-LABEL: define i32 @test_i32(i8*{{.*}} %fmt, ...) {{.*}} { -// CHECK: [[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4 -// CHECK: [[VA:%[^,=]+]] = alloca i8*, align 4 -// CHECK: [[V:%[^,=]+]] = alloca i32, align 4 -// CHECK: store i8* %fmt, i8** [[FMT_ADDR]], align 4 -// CHECK: [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8* -// CHECK: call void @llvm.va_start(i8* [[VA1]]) -// CHECK: [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4 -// CHECK: [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* [[ARGP_CUR]], i32 4 -// CHECK: store i8* [[ARGP_NEXT]], i8** [[VA]], align 4 -// CHECK: [[R3:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to i32* -// CHECK: [[R4:%[^,=]+]] = load i32, i32* [[R3]], align 4 -// CHECK: store i32 [[R4]], i32* [[V]], align 4 -// CHECK: [[VA2:%[^,=]+]] = bitcast i8** [[VA]] to i8* -// CHECK: call void @llvm.va_end(i8* [[VA2]]) -// CHECK: [[R5:%[^,=]+]] = load i32, i32* [[V]], align 4 -// CHECK: ret i32 [[R5]] -// CHECK: } +// CHECK-LABEL: define {{[^@]+}}@test_i64 +// CHECK-SAME: (i8* noundef [[FMT:%.*]], ...) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT:[[FMT_ADDR:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[VA:%.*]] = alloca i8*, align 4 +// CHECK-NEXT:[[V:%.*]] = alloca i64, align 8 +// CHECK-NEXT:store i8* [[FMT]], i8** [[FMT_ADDR]], align 4 +// CHECK-NEXT:[[VA1:%.*]] = bitcast i8** [[VA]] to i8* +// CHECK-NEXT:call void @llvm.va_start(i8* [[VA1]]) +// CHECK-NEXT:[[ARGP_CUR:%.*]] = load i8*, i8** [[VA]], align 4 +// CHECK-NEXT:[[TMP0:%.*]] = ptrtoint i8* [[ARGP_CUR]] to i32 +// CHECK-NEXT:[[TMP1:%.*]] = add i32 [[TMP0]], 7 +// CHECK-NEXT:[[TMP2:%.*]] = and i32 [[TMP1]], -8 +// CHECK-NEXT:[[ARGP_CUR_ALIGNED:%.*]] = inttoptr i32 [[TMP2]] to i8* +// CHECK-NEXT:[[ARGP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[ARGP_CUR_ALIGNED]], i32 8 +// CHECK-NEXT:store i8* [[ARGP_NEXT]], i8** [[VA]], align 4 +// CHECK-NEXT:[[TMP3:%.*]] = bitcast i8* [[ARGP_CUR_ALIGNED]] to i64* +// CHECK-NEXT:[[TMP4:%.*]] = load i64, i64* [[TMP3]], align 8 +// CHECK-NEXT:store i64 [[TMP4]], i64* [[V]], align 8 +// CHECK-NEXT:[[VA2:%.*]] = bitcast i8** [[VA]] to i8* +// CHECK-NEXT:call void @llvm.va_end(i8* [[VA2]]) +// CHECK-NEXT:[[TMP5:%.*]] = load i64, i64* [[V]], align 8 +// CHECK-NEXT:ret i64 [[TMP5]] +// long long test_i64(char *fmt, ...) { va_list va; @@ -41,28 +68,6 @@ long long test_i64(char *fmt, ...) { return v; } -// CHECK-LABEL: define i64 @test_i64(i8*{{.*}} %fmt, ...) {{.*}} { -// CHECK: [[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4 -// CHECK: [[VA:%[^,=]+]] = alloca i8*, align 4 -// CHECK: [[V:%[^,=]+]] = alloca
[clang] 5f01a62 - [ConstantFold] Fix inbounds inference on mismatching source element type
Author: Nikita Popov Date: 2023-01-31T11:33:00+01:00 New Revision: 5f01a626dd0615df49773d419c75aeb33666ee83 URL: https://github.com/llvm/llvm-project/commit/5f01a626dd0615df49773d419c75aeb33666ee83 DIFF: https://github.com/llvm/llvm-project/commit/5f01a626dd0615df49773d419c75aeb33666ee83.diff LOG: [ConstantFold] Fix inbounds inference on mismatching source element type When inferring that a GEP of a global variable is inbounds because there is no notional overindexing, we need to check that the global value type and the GEP source element type match. This was not necessary with typed pointers (because we would have a bitcast in between), but is necessary with opaque pointers. We should be able to recover some of the safe cases by performing an offset based inbounds inference in DL-aware ConstantFolding. Added: Modified: clang/test/CodeGenCXX/no-unique-address.cpp llvm/lib/IR/ConstantFold.cpp llvm/test/Assembler/opaque-ptr.ll llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll llvm/test/Transforms/InstCombine/getelementptr.ll llvm/test/Transforms/InstCombine/memchr-9.ll llvm/test/Transforms/InstCombine/wcslen-1.ll llvm/test/Transforms/InstSimplify/compare.ll Removed: diff --git a/clang/test/CodeGenCXX/no-unique-address.cpp b/clang/test/CodeGenCXX/no-unique-address.cpp index aa58b87555dcc..7b4bbbf2a05d5 100644 --- a/clang/test/CodeGenCXX/no-unique-address.cpp +++ b/clang/test/CodeGenCXX/no-unique-address.cpp @@ -64,7 +64,7 @@ FieldOverlap fo = {{}, {}, {}, {}, 1234}; // CHECK-DAG: @e1 ={{.*}} constant ptr @fo Empty1 = fo.e1; -// CHECK-DAG: @e2 ={{.*}} constant ptr getelementptr inbounds (i8, ptr @fo, i64 1) +// CHECK-DAG: @e2 ={{.*}} constant ptr getelementptr (i8, ptr @fo, i64 1) Empty1 = fo.e2; // CHECK-LABEL: accessE1 diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index f84fe79b21be2..5fa56d30910e4 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -2280,7 +2280,8 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, // check for the "inbounds" property. if (!Unknown && !InBounds) if (auto *GV = dyn_cast(C)) - if (!GV->hasExternalWeakLinkage() && isInBoundsIndices(Idxs)) + if (!GV->hasExternalWeakLinkage() && GV->getValueType() == PointeeTy && + isInBoundsIndices(Idxs)) return ConstantExpr::getGetElementPtr(PointeeTy, C, Idxs, /*InBounds=*/true, InRangeIndex); diff --git a/llvm/test/Assembler/opaque-ptr.ll b/llvm/test/Assembler/opaque-ptr.ll index f950708088f1a..e9e1496756888 100644 --- a/llvm/test/Assembler/opaque-ptr.ll +++ b/llvm/test/Assembler/opaque-ptr.ll @@ -4,7 +4,7 @@ ; CHECK: @global = external global ptr @global = external global ptr -; CHECK: @global_const_gep = global ptr getelementptr inbounds (i47, ptr @global, i64 1) +; CHECK: @global_const_gep = global ptr getelementptr (i47, ptr @global, i64 1) @global_const_gep = global ptr getelementptr (i47, ptr @global, i64 1) ; CHECK: @fptr1 = external global ptr diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll index 3c3b5036eaa26..dc36e936fca54 100644 --- a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll +++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-getelementptr.ll @@ -94,7 +94,7 @@ define void @repeated_constexpr_gep_addrspacecast(i64 %idx0, i64 %idx1) { define void @unorder_constexpr_gep_bitcast() { ; CHECK-LABEL: @unorder_constexpr_gep_bitcast( ; CHECK-NEXT:[[X0:%.*]] = load i32, ptr addrspace(3) @lds, align 4 -; CHECK-NEXT:[[X1:%.*]] = load i32, ptr addrspace(3) getelementptr inbounds (i32, ptr addrspace(3) @lds, i32 1), align 4 +; CHECK-NEXT:[[X1:%.*]] = load i32, ptr addrspace(3) getelementptr (i32, ptr addrspace(3) @lds, i32 1), align 4 ; CHECK-NEXT:call void @use(i32 [[X0]], i32 [[X1]]) ; CHECK-NEXT:ret void ; diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index e67f67c24d266..766abb5923407 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -1334,7 +1334,7 @@ define ptr @const_gep_global_di_i8_larger() { define ptr @const_gep_global_di_i64_larger() { ; CHECK-LABEL: @const_gep_global_di_i64_larger( -; CHECK-NEXT:ret ptr getelementptr inbounds (i32, ptr @g_i32_di, i64 2) +; CHECK-NEXT:ret ptr getelementptr (i32, ptr @g_i32_di, i64 2) ; ret ptr getelementptr (i64, ptr @g_i32_di, i64 1) } diff --git a/llvm/test/Transforms/InstCombine/memchr-9.ll b/llvm/test/Transforms/InstCombine/memchr-9.ll index 00cc90688e2b7..e2c2e6839817c 100644 ---
[clang] 5375b63 - [UTC] Add --version argument
Author: Nikita Popov Date: 2023-01-30T09:57:26+01:00 New Revision: 5375b638be874b5438e98bd8a435e198af3ef2d0 URL: https://github.com/llvm/llvm-project/commit/5375b638be874b5438e98bd8a435e198af3ef2d0 DIFF: https://github.com/llvm/llvm-project/commit/5375b638be874b5438e98bd8a435e198af3ef2d0.diff LOG: [UTC] Add --version argument We have a number of pending changes to update_test_checks.py (and friends) that are essentially blocked on test churn: If the output of UTC for an existing flag combination changes, then the next time a test is regenerated, it will contain many spurious changes. This makes changes to UTC default behavior essentially impossible. Examples of such changes are: * D133943/D142373 want --function-signature to also check the return type/attributes. * D139006/D140212 want to make --function-signature the default behavior. * D142452 wants to add wildcards for block labels. This patch tries to resolve this issue by adding a --version argument, which works as follows: * When regenerating an old test, the default version is 1. * When generating a new test, the default version is the newest. When an explicit version is specified, that of course wins. This means that any currently existing tests will keep using --version 1 format, while any new tests will automatically embed --version N where N is the latest version, and then keep using that test format from then on. This patch only implements the --version flag without bumping the default version, so it does not have any visible behavior change by itself. Differential Revision: https://reviews.llvm.org/D142473 Added: Modified: clang/test/utils/update_cc_test_checks/lit.local.cfg llvm/test/tools/UpdateTestChecks/lit.local.cfg llvm/utils/UpdateTestChecks/common.py Removed: diff --git a/clang/test/utils/update_cc_test_checks/lit.local.cfg b/clang/test/utils/update_cc_test_checks/lit.local.cfg index b78c4ffdab585..b461878880e47 100644 --- a/clang/test/utils/update_cc_test_checks/lit.local.cfg +++ b/clang/test/utils/update_cc_test_checks/lit.local.cfg @@ -26,6 +26,10 @@ else: extra_args = '--clang ' + shell_quote(clang_path) opt_path = os.path.join(config.llvm_tools_dir, 'opt') extra_args += ' --opt ' + shell_quote(opt_path) +# Specify an explicit default version in UTC tests, so that the --version +# embedded in UTC_ARGS does not change in all test expectations every time +# the default is bumped. +extra_args += ' --version=1' script_path = os.path.join(config.llvm_src_root, 'utils', 'update_cc_test_checks.py') assert os.path.isfile(script_path) diff --git a/llvm/test/tools/UpdateTestChecks/lit.local.cfg b/llvm/test/tools/UpdateTestChecks/lit.local.cfg index d9d11b5a06c07..cdaf1b3464d22 100644 --- a/llvm/test/tools/UpdateTestChecks/lit.local.cfg +++ b/llvm/test/tools/UpdateTestChecks/lit.local.cfg @@ -15,6 +15,10 @@ def add_update_script_substition(name, python_exe=config.python_executable, assert name.startswith('%') script_path = os.path.join(config.llvm_src_root, 'utils', name[1:] + '.py') assert os.path.isfile(script_path) +# Specify an explicit default version in UTC tests, so that the --version +# embedded in UTC_ARGS does not change in all test expectations every time +# the default is bumped. +extra_args += ' --version=1' config.substitutions.append( (name, "'%s' %s %s" % (python_exe, script_path, extra_args))) diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index cf382c0ff23fa..7e538d775efa7 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -18,6 +18,13 @@ _verbose = False _prefix_filecheck_ir_name = '' +""" +Version changelog: + +1: Initial version, used by tests that don't specify --version explicitly. +""" +DEFAULT_VERSION = 1 + class Regex(object): """Wrap a compiled regular expression object to allow deep copy of a regexp. This is required for the deep copy done in do_scrub. @@ -138,6 +145,10 @@ def __call__(self, parser, namespace, values, option_string=None): dest='gen_unused_prefix_body', default=True, help='Generate a function body that always matches for unused prefixes. This is useful when unused prefixes are desired, and it avoids needing to annotate each FileCheck as allowing them.') + # This is the default when regenerating existing tests. The default when + # generating new tests is determined by DEFAULT_VERSION. + parser.add_argument('--version', type=int, default=1, + help='The version of output format') args = parser.parse_args() global _verbose, _global_value_regex, _global_hex_value_regex _verbose = args.verbose @@ -226,12 +237,18 @@ def itertests(test_patterns,
[clang] fb6c130 - [LTO] Remove -lto-opaque-pointers flag
Author: Nikita Popov Date: 2023-01-25T12:18:50+01:00 New Revision: fb6c1300f23f249aa29eb6c5325aebc7d61d7345 URL: https://github.com/llvm/llvm-project/commit/fb6c1300f23f249aa29eb6c5325aebc7d61d7345 DIFF: https://github.com/llvm/llvm-project/commit/fb6c1300f23f249aa29eb6c5325aebc7d61d7345.diff LOG: [LTO] Remove -lto-opaque-pointers flag Always use the config default of OpaquePointers == true. Added: Modified: clang/test/CodeGen/thinlto-inline-asm2.c clang/test/Driver/arm-float-abi-lto.c clang/test/Driver/memtag-stack_lto.c llvm/test/LTO/X86/mix-opaque-typed.ll llvm/tools/llvm-lto2/llvm-lto2.cpp Removed: diff --git a/clang/test/CodeGen/thinlto-inline-asm2.c b/clang/test/CodeGen/thinlto-inline-asm2.c index 7606b27deac87..5d7bbc097de7c 100644 --- a/clang/test/CodeGen/thinlto-inline-asm2.c +++ b/clang/test/CodeGen/thinlto-inline-asm2.c @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -flto=thin -emit-llvm-bc %t/b.c -o %t/b.bc // RUN: llvm-nm %t/a.bc | FileCheck %s --check-prefix=NM -// RUN: llvm-lto2 run -lto-opaque-pointers %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl +// RUN: llvm-lto2 run %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl // RUN: llvm-dis < %t/out.2.2.internalize.bc | FileCheck %s //--- a.c diff --git a/clang/test/Driver/arm-float-abi-lto.c b/clang/test/Driver/arm-float-abi-lto.c index 8b6d8ff6b5d7a..b8788f485cbff 100644 --- a/clang/test/Driver/arm-float-abi-lto.c +++ b/clang/test/Driver/arm-float-abi-lto.c @@ -4,7 +4,7 @@ // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=full -c -o %t.call_full.bc -DCALL_LIB // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=full -c -o %t.define_full.bc -DDEFINE_LIB -// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.lto_full -save-temps %t.call_full.bc %t.define_full.bc \ +// RUN: llvm-lto2 run -o %t.lto_full -save-temps %t.call_full.bc %t.define_full.bc \ // RUN: -r %t.call_full.bc,fn,px \ // RUN: -r %t.call_full.bc,fwrite,l \ // RUN: -r %t.call_full.bc,putchar,l \ @@ -16,7 +16,7 @@ // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=thin -c -o %t.call_thin.bc -DCALL_LIB // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -Xclang -opaque-pointers -flto=thin -c -o %t.define_thin.bc -DDEFINE_LIB -// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \ +// RUN: llvm-lto2 run -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \ // RUN: -r %t.call_thin.bc,fn,px \ // RUN: -r %t.call_thin.bc,fwrite,l \ // RUN: -r %t.call_thin.bc,putchar,l \ diff --git a/clang/test/Driver/memtag-stack_lto.c b/clang/test/Driver/memtag-stack_lto.c index 2fe15a119d2a7..3cafe83069a0b 100644 --- a/clang/test/Driver/memtag-stack_lto.c +++ b/clang/test/Driver/memtag-stack_lto.c @@ -10,7 +10,7 @@ // Full LTO // RUN: %clang -O1 -target aarch64-unknown-linux -c %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.ltonewpm1.bc,fn,plx \ // RUN: -r %t.ltonewpm1.bc,use,lx \ // RUN: -r %t.ltonewpm1.bc,use_local,plx \ @@ -21,7 +21,7 @@ // Thin LTO, new PM // RUN: %clang -O1 -target aarch64-unknown-linux -c %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -Xclang -opaque-pointers -flto=thin -o %t.thinltonewpm2.bc -// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.thinltonewpm1.bc,fn,plx \ // RUN: -r %t.thinltonewpm1.bc,use,lx \ // RUN: -r %t.thinltonewpm1.bc,use_local,plx \ @@ -41,7 +41,7 @@ // Full LTO: both are safe. // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c -DBUILD2 %s -Xclang -opaque-pointers -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -lto-opaque-pointers -o %t.ltonewpm
[clang] b164b04 - [Clang] Convert test to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-01-17T10:08:57+01:00 New Revision: b164b047f2b41ff0c0a3ede3baa29c230c78cd32 URL: https://github.com/llvm/llvm-project/commit/b164b047f2b41ff0c0a3ede3baa29c230c78cd32 DIFF: https://github.com/llvm/llvm-project/commit/b164b047f2b41ff0c0a3ede3baa29c230c78cd32.diff LOG: [Clang] Convert test to opaque pointers (NFC) Added: Modified: clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu Removed: diff --git a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu index 4694d7e38c2f9..a5135ab01f0f3 100644 --- a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu +++ b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu @@ -1,9 +1,9 @@ // REQUIRES: x86-registered-target // REQUIRES: amdgpu-registered-target -// RUN: %clang_cc1 -no-opaque-pointers -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x hip %s -o - | FileCheck --check-prefixes=COMMON,CHECK %s -// RUN: %clang_cc1 -no-opaque-pointers -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x hip %s -disable-O0-optnone -o - | opt -S -O2 | FileCheck %s --check-prefixes=COMMON,OPT -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -x hip %s -o - | FileCheck -check-prefix=HOST %s +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x hip %s -o - | FileCheck --check-prefixes=COMMON,CHECK %s +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -emit-llvm -x hip %s -disable-O0-optnone -o - | opt -S -O2 | FileCheck %s --check-prefixes=COMMON,OPT +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -x hip %s -o - | FileCheck -check-prefix=HOST %s #include "Inputs/cuda.h" @@ -14,40 +14,40 @@ // HOST-NOT: %struct.S.coerce // HOST-NOT: %struct.T.coerce -// HOST: define{{.*}} void @_Z22__device_stub__kernel1Pi(i32* noundef %x) -// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(i32 addrspace(1)*{{.*}} %x.coerce) -// CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to [[TYPE]]* -// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to [[TYPE]]* -// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, !amdgpu.noclobber ![[MD:[0-9]+]] +// HOST: define{{.*}} void @_Z22__device_stub__kernel1Pi(ptr noundef %x) +// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(ptr addrspace(1){{.*}} %x.coerce) +// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr +// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr +// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, !amdgpu.noclobber ![[MD:[0-9]+]] // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1 -// OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4 +// OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4 // OPT: ret void __global__ void kernel1(int *x) { x[0]++; } -// HOST: define{{.*}} void @_Z22__device_stub__kernel2Ri(i32* noundef nonnull align 4 dereferenceable(4) %x) -// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(i32 addrspace(1)*{{.*}} nonnull align 4 dereferenceable(4) %x.coerce) -// CHECK: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to [[TYPE]]* -// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to [[TYPE]]* -// OPT: [[VAL:%.*]] = load i32, i32 addrspace(1)* %x.coerce, align 4, !amdgpu.noclobber ![[MD]] +// HOST: define{{.*}} void @_Z22__device_stub__kernel2Ri(ptr noundef nonnull align 4 dereferenceable(4) %x) +// COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(ptr addrspace(1){{.*}} nonnull align 4 dereferenceable(4) %x.coerce) +// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr +// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr +// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, !amdgpu.noclobber ![[MD]] // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1 -// OPT: store i32 [[INC]], i32 addrspace(1)* %x.coerce, align 4 +// OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4 // OPT: ret void __global__ void kernel2(int ) { x++; } -// HOST: define{{.*}} void @_Z22__device_stub__kernel3PU3AS2iPU3AS1i(i32 addrspace(2)* noundef %x, i32 addrspace(1)* noundef %y) -// CHECK-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel3PU3AS2iPU3AS1i(i32 addrspace(2)*{{.*}} %x, i32 addrspace(1)*{{.*}} %y) -// CHECK-NOT: ={{.*}} addrspacecast [[TYPE:.*]] addrspace(1)* %{{.*}} to [[TYPE]]* +// HOST: define{{.*}} void @_Z22__device_stub__kernel3PU3AS2iPU3AS1i(ptr addrspace(2) noundef %x, ptr addrspace(1) noundef %y) +// CHECK-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel3PU3AS2iPU3AS1i(ptr addrspace(2){{.*}} %x, ptr addrspace(1){{.*}} %y) +// CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr __global__ void
[clang] 0285656 - [Clang] Emit noundef metadata next to range metadata
Author: Nikita Popov Date: 2023-01-12T10:03:05+01:00 New Revision: 02856565ac12e21f14f2af64ce1135ecc3c2021f URL: https://github.com/llvm/llvm-project/commit/02856565ac12e21f14f2af64ce1135ecc3c2021f DIFF: https://github.com/llvm/llvm-project/commit/02856565ac12e21f14f2af64ce1135ecc3c2021f.diff LOG: [Clang] Emit noundef metadata next to range metadata To preserve the previous semantics after D141386, adjust places that currently emit !range metadata to also emit !noundef metadata. This retains range violation as immediate undefined behavior, rather than just poison. Differential Revision: https://reviews.llvm.org/D141494 Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGExpr.cpp clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu clang/test/CodeGenCXX/attr-likelihood-if-branch-weights.cpp clang/test/CodeGenCXX/pr12251.cpp clang/test/CodeGenOpenCL/builtins-amdgcn.cl Removed: diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 430b5f43cdd5a..479e24245df4d 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -687,6 +687,8 @@ static Value *emitRangedBuiltin(CodeGenFunction , Function *F = CGF.CGM.getIntrinsic(IntrinsicID, {}); llvm::Instruction *Call = CGF.Builder.CreateCall(F); Call->setMetadata(llvm::LLVMContext::MD_range, RNode); +Call->setMetadata(llvm::LLVMContext::MD_noundef, + llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); return Call; } @@ -16785,6 +16787,8 @@ Value *EmitAMDGPUWorkGroupSize(CodeGenFunction , unsigned Index) { llvm::MDNode *RNode = MDHelper.createRange(APInt(16, 1), APInt(16, CGF.getTarget().getMaxOpenCLWorkGroupSize() + 1)); LD->setMetadata(llvm::LLVMContext::MD_range, RNode); + LD->setMetadata(llvm::LLVMContext::MD_noundef, + llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); LD->setMetadata(llvm::LLVMContext::MD_invariant_load, llvm::MDNode::get(CGF.getLLVMContext(), std::nullopt)); return LD; diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 6d5e729b1eea9..34974c63984e6 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1751,8 +1751,11 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile, // In order to prevent the optimizer from throwing away the check, don't // attach range metadata to the load. } else if (CGM.getCodeGenOpts().OptimizationLevel > 0) -if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) +if (llvm::MDNode *RangeInfo = getRangeForLoadFromType(Ty)) { Load->setMetadata(llvm::LLVMContext::MD_range, RangeInfo); + Load->setMetadata(llvm::LLVMContext::MD_noundef, +llvm::MDNode::get(getLLVMContext(), std::nullopt)); +} return EmitFromMemory(Load, Ty); } diff --git a/clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu b/clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu index e506b875b6748..c098917a0a0e2 100644 --- a/clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu +++ b/clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu @@ -12,20 +12,20 @@ // PRECOV5-LABEL: test_get_workgroup_size // PRECOV5: call align 4 dereferenceable(64) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() // PRECOV5: getelementptr i8, ptr addrspace(4) %{{.*}}, i32 4 -// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load +// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef // PRECOV5: getelementptr i8, ptr addrspace(4) %{{.*}}, i32 6 -// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load +// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef // PRECOV5: getelementptr i8, ptr addrspace(4) %{{.*}}, i32 8 -// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load +// PRECOV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef // COV5-LABEL: test_get_workgroup_size // COV5: call align 8 dereferenceable(256) ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() // COV5: getelementptr i8, ptr addrspace(4) %{{.*}}, i32 12 -// COV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load +// COV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef // COV5: getelementptr i8, ptr addrspace(4) %{{.*}}, i32 14 -// COV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load +// COV5: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}},
[clang] ebd9753 - [CodeGenOpenCLCXX] Convert tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2023-01-05T11:03:15+01:00 New Revision: ebd97534e71aafaa637e466d700f66bbfa63d56b URL: https://github.com/llvm/llvm-project/commit/ebd97534e71aafaa637e466d700f66bbfa63d56b DIFF: https://github.com/llvm/llvm-project/commit/ebd97534e71aafaa637e466d700f66bbfa63d56b.diff LOG: [CodeGenOpenCLCXX] Convert tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp clang/test/CodeGenOpenCLCXX/atexit.clcpp clang/test/CodeGenOpenCLCXX/constexpr.clcpp clang/test/CodeGenOpenCLCXX/method-overload-address-space.clcpp clang/test/CodeGenOpenCLCXX/reinterpret_cast.clcpp clang/test/CodeGenOpenCLCXX/template-address-spaces.clcpp Removed: diff --git a/clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp b/clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp index 40bac730fd00b..5d7360f406dc3 100644 --- a/clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp +++ b/clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -no-opaque-pointers %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s -check-prefixes=COMMON,PTR -// RUN: %clang_cc1 -no-opaque-pointers %s -triple spir-unknown-unknown -O0 -emit-llvm -o - -DREF | FileCheck %s -check-prefixes=COMMON,REF +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s -check-prefixes=COMMON,PTR +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - -DREF | FileCheck %s -check-prefixes=COMMON,REF #ifdef REF #define PTR & @@ -11,26 +11,26 @@ //COMMON: @glob ={{.*}} addrspace(1) global i32 int glob; -//PTR: @glob_p ={{.*}} addrspace(1) global i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @glob to i32 addrspace(4)*) -//REF: @glob_p ={{.*}} addrspace(1) constant i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @glob to i32 addrspace(4)*) +//PTR: @glob_p ={{.*}} addrspace(1) global ptr addrspace(4) addrspacecast (ptr addrspace(1) @glob to ptr addrspace(4)) +//REF: @glob_p ={{.*}} addrspace(1) constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @glob to ptr addrspace(4)) int PTR glob_p = ADR(glob); //COMMON: @_ZZ3fooi{{P|R}}U3AS4iE6loc_st = internal addrspace(1) global i32 -//PTR: @_ZZ3fooiPU3AS4iE8loc_st_p = internal addrspace(1) global i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @_ZZ3fooiPU3AS4iE6loc_st to i32 addrspace(4)*) -//REF: @_ZZ3fooiRU3AS4iE8loc_st_p = internal addrspace(1) constant i32 addrspace(4)* addrspacecast (i32 addrspace(1)* @_ZZ3fooiRU3AS4iE6loc_st to i32 addrspace(4)*) -//COMMON: @loc_ext_p = external addrspace(1) {{global|constant}} i32 addrspace(4)* +//PTR: @_ZZ3fooiPU3AS4iE8loc_st_p = internal addrspace(1) global ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZZ3fooiPU3AS4iE6loc_st to ptr addrspace(4)) +//REF: @_ZZ3fooiRU3AS4iE8loc_st_p = internal addrspace(1) constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZZ3fooiRU3AS4iE6loc_st to ptr addrspace(4)) +//COMMON: @loc_ext_p = external addrspace(1) {{global|constant}} ptr addrspace(4) //COMMON: @loc_ext = external addrspace(1) global i32 -//COMMON: define{{.*}} spir_func noundef i32 @_Z3fooi{{P|R}}U3AS4i(i32 noundef %par, i32 addrspace(4)*{{.*}} %par_p) +//COMMON: define{{.*}} spir_func noundef i32 @_Z3fooi{{P|R}}U3AS4i(i32 noundef %par, ptr addrspace(4){{.*}} %par_p) int foo(int par, int PTR par_p){ //COMMON: %loc = alloca i32 int loc; - //COMMON: %loc_p = alloca i32 addrspace(4)* - //COMMON: %loc_p_const = alloca i32* - //COMMON: [[GAS:%[._a-z0-9]*]] ={{.*}} addrspacecast i32* %loc to i32 addrspace(4)* - //COMMON: store i32 addrspace(4)* [[GAS]], i32 addrspace(4)** %loc_p + //COMMON: %loc_p = alloca ptr addrspace(4) + //COMMON: %loc_p_const = alloca ptr + //COMMON: [[GAS:%[._a-z0-9]*]] ={{.*}} addrspacecast ptr %loc to ptr addrspace(4) + //COMMON: store ptr addrspace(4) [[GAS]], ptr %loc_p int PTR loc_p = ADR(loc); - //COMMON: store i32* %loc, i32** %loc_p_const + //COMMON: store ptr %loc, ptr %loc_p_const const __private int PTR loc_p_const = ADR(loc); // CHECK directives for the following code are located above. diff --git a/clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp b/clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp index 3a87d47acc839..62258cae90647 100644 ---
[clang] e20cc31 - [Clang] Convert test to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-12-14T17:03:27+01:00 New Revision: e20cc31ae4fd32c131adc46e92862225a7a8e931 URL: https://github.com/llvm/llvm-project/commit/e20cc31ae4fd32c131adc46e92862225a7a8e931 DIFF: https://github.com/llvm/llvm-project/commit/e20cc31ae4fd32c131adc46e92862225a7a8e931.diff LOG: [Clang] Convert test to opaque pointers (NFC) Required a lot of manual, but uninteresting, fixup. Added: Modified: clang/test/CodeGen/64bit-swiftcall.c Removed: diff --git a/clang/test/CodeGen/64bit-swiftcall.c b/clang/test/CodeGen/64bit-swiftcall.c index f1fb8e10dc0a..5290de2471e8 100644 --- a/clang/test/CodeGen/64bit-swiftcall.c +++ b/clang/test/CodeGen/64bit-swiftcall.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple x86_64-apple-darwin10 -target-cpu core2 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple x86_64-apple-darwin10 -target-cpu core2 -emit-llvm -o - %s | FileCheck %s --check-prefix=X86-64 -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple arm64-apple-ios9 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -triple arm64-apple-ios9 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=ARM64 +// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-apple-darwin10 -target-cpu core2 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -triple x86_64-apple-darwin10 -target-cpu core2 -emit-llvm -o - %s | FileCheck %s --check-prefix=X86-64 +// RUN: %clang_cc1 -no-enable-noundef-analysis -triple arm64-apple-ios9 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -no-enable-noundef-analysis -triple arm64-apple-ios9 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=ARM64 // REQUIRES: aarch64-registered-target,x86-registered-target @@ -22,35 +22,35 @@ /*/ SWIFTCALL void indirect_result_1(OUT int *arg0, OUT float *arg1) {} -// CHECK-LABEL: define {{.*}} void @indirect_result_1(i32* noalias sret(i32*) align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) +// CHECK-LABEL: define {{.*}} void @indirect_result_1(ptr noalias sret(ptr) align 4 dereferenceable(4){{.*}}, ptr noalias align 4 dereferenceable(4){{.*}}) // TODO: maybe this shouldn't suppress sret. SWIFTCALL int indirect_result_2(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } -// CHECK-LABEL: define {{.*}} i32 @indirect_result_2(i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) +// CHECK-LABEL: define {{.*}} i32 @indirect_result_2(ptr noalias align 4 dereferenceable(4){{.*}}, ptr noalias align 4 dereferenceable(4){{.*}}) typedef struct { char array[1024]; } struct_reallybig; SWIFTCALL struct_reallybig indirect_result_3(OUT int *arg0, OUT float *arg1) { __builtin_unreachable(); } -// CHECK-LABEL: define {{.*}} void @indirect_result_3({{.*}}* noalias sret(%struct.struct_reallybig) {{.*}}, i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}}) +// CHECK-LABEL: define {{.*}} void @indirect_result_3(ptr noalias sret(%struct.struct_reallybig) {{.*}}, ptr noalias align 4 dereferenceable(4){{.*}}, ptr noalias align 4 dereferenceable(4){{.*}}) SWIFTCALL void context_1(CONTEXT void *self) {} -// CHECK-LABEL: define {{.*}} void @context_1(i8* swiftself +// CHECK-LABEL: define {{.*}} void @context_1(ptr swiftself SWIFTASYNCCALL void async_context_1(ASYNC_CONTEXT void *ctx) {} -// CHECK-LABEL: define {{.*}} void @async_context_1(i8* swiftasync +// CHECK-LABEL: define {{.*}} void @async_context_1(ptr swiftasync SWIFTCALL void context_2(void *arg0, CONTEXT void *self) {} -// CHECK-LABEL: define {{.*}} void @context_2(i8*{{.*}}, i8* swiftself +// CHECK-LABEL: define {{.*}} void @context_2(ptr{{.*}}, ptr swiftself SWIFTASYNCCALL void async_context_2(void *arg0, ASYNC_CONTEXT void *ctx) {} -// CHECK-LABEL: define {{.*}} void @async_context_2(i8*{{.*}}, i8* swiftasync +// CHECK-LABEL: define {{.*}} void @async_context_2(ptr{{.*}}, ptr swiftasync SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {} -// CHECK-LABEL: define {{.*}} void @context_error_1(i32* swiftself{{.*}}, float** swifterror %0) -// CHECK: [[TEMP:%.*]] = alloca float*, align 8 -// CHECK: [[T0:%.*]] = load float*, float** [[ERRORARG:%.*]], align 8 -// CHECK: store float* [[T0]], float** [[TEMP]], align 8 -// CHECK: [[T0:%.*]] = load float*, float** [[TEMP]], align 8 -// CHECK: store float* [[T0]], float** [[ERRORARG]], align 8 +// CHECK-LABEL: define {{.*}} void @context_error_1(ptr swiftself{{.*}}, ptr
[clang] d8f91f2 - [CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-12-14T13:36:07+01:00 New Revision: d8f91f2c1d0955da5d30ca297f2979bf6c01d8a3 URL: https://github.com/llvm/llvm-project/commit/d8f91f2c1d0955da5d30ca297f2979bf6c01d8a3 DIFF: https://github.com/llvm/llvm-project/commit/d8f91f2c1d0955da5d30ca297f2979bf6c01d8a3.diff LOG: [CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC) Added: Modified: clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu clang/test/CodeGenCUDASPIRV/kernel-argument.cu Removed: diff --git a/clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu b/clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu index bceca4d4ee5d6..2692ce4c92b28 100644 --- a/clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu +++ b/clang/test/CodeGenCUDASPIRV/copy-aggregate-byval.cu @@ -1,12 +1,12 @@ // Tests CUDA kernel arguments get copied by value when targeting SPIR-V, even with // destructor, copy constructor or move constructor defined by user. -// RUN: %clang -Xclang -no-opaque-pointers -emit-llvm --cuda-device-only --offload=spirv32 \ +// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv32 \ // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 // RUN: llvm-dis %t.bc -o %t.ll // RUN: FileCheck %s --input-file=%t.ll -// RUN: %clang -Xclang -no-opaque-pointers -emit-llvm --cuda-device-only --offload=spirv64 \ +// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv64 \ // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 // RUN: llvm-dis %t.bc -o %t.ll // RUN: FileCheck %s --input-file=%t.ll @@ -20,6 +20,6 @@ class GpuData { }; // CHECK: define -// CHECK-SAME: spir_kernel void @_Z6kernel7GpuData(%class.GpuData* noundef byval(%class.GpuData) align +// CHECK-SAME: spir_kernel void @_Z6kernel7GpuData(ptr noundef byval(%class.GpuData) align __attribute__((global)) void kernel(GpuData output) {} diff --git a/clang/test/CodeGenCUDASPIRV/kernel-argument.cu b/clang/test/CodeGenCUDASPIRV/kernel-argument.cu index cfc41ad7a535f..ab885eb3d85c4 100644 --- a/clang/test/CodeGenCUDASPIRV/kernel-argument.cu +++ b/clang/test/CodeGenCUDASPIRV/kernel-argument.cu @@ -1,17 +1,17 @@ // Tests CUDA kernel arguments get global address space when targetting SPIR-V. -// RUN: %clang -Xclang -no-opaque-pointers -emit-llvm --cuda-device-only --offload=spirv32 \ +// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv32 \ // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 // RUN: llvm-dis %t.bc -o %t.ll // RUN: FileCheck %s --input-file=%t.ll -// RUN: %clang -Xclang -no-opaque-pointers -emit-llvm --cuda-device-only --offload=spirv64 \ +// RUN: %clang -emit-llvm --cuda-device-only --offload=spirv64 \ // RUN: -nocudalib -nocudainc %s -o %t.bc -c 2>&1 // RUN: llvm-dis %t.bc -o %t.ll // RUN: FileCheck %s --input-file=%t.ll // CHECK: define -// CHECK-SAME: spir_kernel void @_Z6kernelPi(i32 addrspace(1)* noundef +// CHECK-SAME: spir_kernel void @_Z6kernelPi(ptr addrspace(1) noundef __attribute__((global)) void kernel(int* output) { *output = 1; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 697bfa4 - Revert "[UpdateTestChecks] Match define for labels"
Author: Nikita Popov Date: 2022-12-13T09:15:35+01:00 New Revision: 697bfa40a3f853d8b9103ead53cd80a4f7c5a7df URL: https://github.com/llvm/llvm-project/commit/697bfa40a3f853d8b9103ead53cd80a4f7c5a7df DIFF: https://github.com/llvm/llvm-project/commit/697bfa40a3f853d8b9103ead53cd80a4f7c5a7df.diff LOG: Revert "[UpdateTestChecks] Match define for labels" This reverts commit a25aeef8d6592c6cf5f4e5854cc39af49633. This changes the default output of UTC, and as such introduces spurious changes whenever existing tests are regenerated. I've indicated in https://reviews.llvm.org/D139006#3989954 how this can be implemented without causing test churn. Added: Modified: clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.plain.expected clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected clang/test/utils/update_cc_test_checks/Inputs/ifdef.c.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c.expected clang/test/utils/update_cc_test_checks/Inputs/replace-value-regex-across-runs.c.expected clang/test/utils/update_cc_test_checks/check-globals.test llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.plain.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/custom-tool.ll.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.globals.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.globals.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.scrub.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected llvm/utils/UpdateTestChecks/common.py Removed: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/define_after_call.ll llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/define_after_call.ll.expected llvm/test/tools/UpdateTestChecks/update_test_checks/define_after_call.test diff --git a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected index ccd308688374..6c7dd730e543 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected @@ -8,7 +8,7 @@ class Foo { public: explicit Foo(int x); ~Foo(); -// CHECK-LABEL: define {{[^@]+}}@_ZNK3Foo23function_defined_inlineEi( +// CHECK-LABEL: @_ZNK3Foo23function_defined_inlineEi( // CHECK-NEXT: entry: // CHECK-NEXT:[[THIS_ADDR:%.*]] = alloca %class.Foo*, align 8 // CHECK-NEXT:[[ARG_ADDR:%.*]] = alloca i32, align 4 @@ -27,7 +27,7 @@ public: inline int function_defined_out_of_line(int arg) const; }; -// CHECK-LABEL: define {{[^@]+}}@_ZN3FooC1Ei( +// CHECK-LABEL: @_ZN3FooC1Ei( // CHECK-NEXT: entry: // CHECK-NEXT:[[THIS_ADDR:%.*]] = alloca %class.Foo*, align 8 // CHECK-NEXT:[[X_ADDR:%.*]] = alloca i32, align 4 @@ -39,7
[clang] 11b9c79 - [Clang] Try to fix test on Windows (NFC)
Author: Nikita Popov Date: 2022-12-12T20:36:35+01:00 New Revision: 11b9c7943bad1915e3ba096b597af3d050048d53 URL: https://github.com/llvm/llvm-project/commit/11b9c7943bad1915e3ba096b597af3d050048d53 DIFF: https://github.com/llvm/llvm-project/commit/11b9c7943bad1915e3ba096b597af3d050048d53.diff LOG: [Clang] Try to fix test on Windows (NFC) Try to fix failure reported in https://reviews.llvm.org/rG9466b49171dc#1154213 by making the match more specific, as there are multiple dbg.declares that could be matched. Added: Modified: clang/test/CodeGenObjC/2010-02-09-DbgSelf.m Removed: diff --git a/clang/test/CodeGenObjC/2010-02-09-DbgSelf.m b/clang/test/CodeGenObjC/2010-02-09-DbgSelf.m index df2f8bec20f05..ad8b29a85ea14 100644 --- a/clang/test/CodeGenObjC/2010-02-09-DbgSelf.m +++ b/clang/test/CodeGenObjC/2010-02-09-DbgSelf.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -x objective-c -emit-llvm -debug-info-kind=limited < %s | FileCheck %s // Test to check that "self" argument is assigned a location. -// CHECK: call void @llvm.dbg.declare(metadata ptr %{{[^,]+}}, metadata [[SELF:![0-9]*]], metadata !{{.*}}) +// CHECK: call void @llvm.dbg.declare(metadata ptr %self.addr, metadata [[SELF:![0-9]*]], metadata !{{.*}}) // CHECK: [[SELF]] = !DILocalVariable(name: "self", arg: 1, @interface Foo ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6271805 - [Clang] Update Profile tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-12-12T16:28:03+01:00 New Revision: 627180562911b93a523fea000511311ed0d381e4 URL: https://github.com/llvm/llvm-project/commit/627180562911b93a523fea000511311ed0d381e4 DIFF: https://github.com/llvm/llvm-project/commit/627180562911b93a523fea000511311ed0d381e4.diff LOG: [Clang] Update Profile tests to opaque pointers (NFC) Added: Modified: clang/test/Profile/c-captured.c clang/test/Profile/c-general.c clang/test/Profile/c-indirect-call.c clang/test/Profile/c-linkage-available_externally.c clang/test/Profile/c-ternary.c clang/test/Profile/c-unprofiled-blocks.c clang/test/Profile/c-unreachable-after-switch.c clang/test/Profile/cxx-abc-deleting-dtor.cpp clang/test/Profile/cxx-class.cpp clang/test/Profile/cxx-indirect-call.cpp clang/test/Profile/cxx-lambda.cpp clang/test/Profile/cxx-rangefor.cpp clang/test/Profile/cxx-stmt-initializers.cpp clang/test/Profile/cxx-templates.cpp clang/test/Profile/cxx-throws.cpp Removed: diff --git a/clang/test/Profile/c-captured.c b/clang/test/Profile/c-captured.c index cfc64b7a7ae64..3a802494eb6a6 100644 --- a/clang/test/Profile/c-captured.c +++ b/clang/test/Profile/c-captured.c @@ -1,14 +1,14 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOGEN -check-prefix=PGOALL %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOGEN -check-prefix=PGOALL %s // RUN: llvm-profdata merge %S/Inputs/c-captured.proftext -o %t.profdata -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOUSE -check-prefix=PGOALL %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOUSE -check-prefix=PGOALL %s // PGOGEN: @[[DCC:__profc_debug_captured]] = private global [3 x i64] zeroinitializer // PGOGEN: @[[CSC:__profc_c_captured.c___captured_stmt]] = private global [2 x i64] zeroinitializer // PGOGEN: @[[C1C:__profc_c_captured.c___captured_stmt.1]] = private global [3 x i64] zeroinitializer // PGOALL-LABEL: define{{.*}} void @debug_captured() -// PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 0 +// PGOGEN: store {{.*}} @[[DCC]] void debug_captured(void) { int x = 10; @@ -20,7 +20,7 @@ void debug_captured(void) { // PGOALL: ret // PGOALL-LABEL: define internal void @__captured_stmt( -// PGOGEN: store {{.*}} @[[CSC]], i32 0, i32 0 +// PGOGEN: store {{.*}} @[[CSC]] #pragma clang __debug captured { // PGOGEN: store {{.*}} @[[CSC]], i32 0, i32 1 @@ -32,7 +32,7 @@ void debug_captured(void) { if (x) {} // This is DC1. Checked above. // PGOALL-LABEL: define internal void @__captured_stmt.1( -// PGOGEN: store {{.*}} @[[C1C]], i32 0, i32 0 +// PGOGEN: store {{.*}} @[[C1C]] #pragma clang __debug captured { // PGOGEN: store {{.*}} @[[C1C]], i32 0, i32 1 diff --git a/clang/test/Profile/c-general.c b/clang/test/Profile/c-general.c index 4c354373d2754..b841f9c3d2a1d 100644 --- a/clang/test/Profile/c-general.c +++ b/clang/test/Profile/c-general.c @@ -1,13 +1,13 @@ // Test instrumentation of general constructs in C. -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOGEN %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOGEN %s // RUN: llvm-profdata merge %S/Inputs/c-general.proftext -o %t.profdata -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOUSE %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instrument-use-path=%S/Inputs/c-general.profdata.v5 | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOUSE %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instrument-use-path=%S/Inputs/c-general.profdata.v3 | FileCheck -allow-deprecated-dag-overlap -check-prefix=PGOUSE %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9
[clang] 8cdb1aa - [Clang] Convert PCH tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-12-12T16:20:49+01:00 New Revision: 8cdb1aa1ec2ba15f5ec8641f5ece23758bf15a06 URL: https://github.com/llvm/llvm-project/commit/8cdb1aa1ec2ba15f5ec8641f5ece23758bf15a06 DIFF: https://github.com/llvm/llvm-project/commit/8cdb1aa1ec2ba15f5ec8641f5ece23758bf15a06.diff LOG: [Clang] Convert PCH tests to opaque pointers (NFC) Added: Modified: clang/test/PCH/block-helpers.cpp clang/test/PCH/builtin-is-constant-evaluated.cpp clang/test/PCH/chain-openmp-threadprivate.cpp clang/test/PCH/chain-pending-instantiations.cpp clang/test/PCH/dllexport-default-arg-closure.cpp clang/test/PCH/pr27445.cpp clang/test/PCH/pragma-weak-functional.c Removed: diff --git a/clang/test/PCH/block-helpers.cpp b/clang/test/PCH/block-helpers.cpp index 33bd5fad5aa0b..b66abf71b73e5 100644 --- a/clang/test/PCH/block-helpers.cpp +++ b/clang/test/PCH/block-helpers.cpp @@ -1,23 +1,20 @@ -// RUN: %clang_cc1 -no-opaque-pointers -x c++-header -triple x86_64-apple-darwin11 -emit-pch -fblocks -fexceptions -o %t %S/block-helpers.h -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin11 -include-pch %t -emit-llvm -fblocks -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c++-header -triple x86_64-apple-darwin11 -emit-pch -fblocks -fexceptions -o %t %S/block-helpers.h +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -include-pch %t -emit-llvm -fblocks -fexceptions -o - %s | FileCheck %s -// CHECK: %[[STRUCT_BLOCK_BYREF_X:.*]] = type { i8*, %[[STRUCT_BLOCK_BYREF_X]]*, i32, i32, i8*, i8*, %[[STRUCT_S0:.*]] } +// CHECK: %[[STRUCT_BLOCK_BYREF_X:.*]] = type { ptr, ptr, i32, i32, ptr, ptr, %[[STRUCT_S0:.*]] } // CHECK: %[[STRUCT_S0]] = type { i32 } -// CHECK: %[[STRUCT_BLOCK_BYREF_Y:.*]] = type { i8*, %[[STRUCT_BLOCK_BYREF_Y]]*, i32, i32, i8*, i8*, %[[STRUCT_S0]] } -// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i64, i64 } +// CHECK: %[[STRUCT_BLOCK_BYREF_Y:.*]] = type { ptr, ptr, i32, i32, ptr, ptr, %[[STRUCT_S0]] } // Check that byref structs are allocated for x and y. // CHECK-LABEL: define linkonce_odr void @_ZN1S1mEv( // CHECK: %[[X:.*]] = alloca %[[STRUCT_BLOCK_BYREF_X]], align 8 // CHECK: %[[Y:.*]] = alloca %[[STRUCT_BLOCK_BYREF_Y]], align 8 -// CHECK: %[[BLOCK:.*]] = alloca <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8* }>, align 8 -// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8* }>* %[[BLOCK]], i32 0, i32 5 -// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_BLOCK_BYREF_X]]* %[[X]] to i8* -// CHECK: store i8* %[[V0]], i8** %[[BLOCK_CAPTURED]], align 8 -// CHECK: %[[BLOCK_CAPTURED10:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8* }>, <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]*, i8*, i8* }>* %[[BLOCK]], i32 0, i32 6 -// CHECK: %[[V1:.*]] = bitcast %[[STRUCT_BLOCK_BYREF_Y]]* %[[Y]] to i8* -// CHECK: store i8* %[[V1]], i8** %[[BLOCK_CAPTURED10]], align 8 +// CHECK: %[[BLOCK:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, ptr, ptr }>, align 8 +// CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 5 +// CHECK: store ptr %[[X]], ptr %[[BLOCK_CAPTURED]], align 8 +// CHECK: %[[BLOCK_CAPTURED10:.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, ptr, ptr }>, ptr %[[BLOCK]], i32 0, i32 6 +// CHECK: store ptr %[[Y]], ptr %[[BLOCK_CAPTURED10]], align 8 // CHECK-LABEL: define internal void @___ZN1S1mEv_block_invoke( diff --git a/clang/test/PCH/builtin-is-constant-evaluated.cpp b/clang/test/PCH/builtin-is-constant-evaluated.cpp index 558676fc78bf2..a74f493415a35 100644 --- a/clang/test/PCH/builtin-is-constant-evaluated.cpp +++ b/clang/test/PCH/builtin-is-constant-evaluated.cpp @@ -1,14 +1,14 @@ -// RUN: %clang_cc1 -no-opaque-pointers -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -include %s -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -emit-pch %s -o %t -// RUN: %clang_cc1 -no-opaque-pointers -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -include %s -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -emit-pch %s -o %t +// RUN: %clang_cc1 -std=c++98 -Wno-constant-evaluated -triple x86_64-linux -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -std=c++11 -Wno-constant-evaluated -triple x86_64-linux -include %s -verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CXX11 -// RUN: %clang_cc1
[clang] 5f84369 - [Clang] Convert CXX tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-12-12T14:49:32+01:00 New Revision: 5f843693a461696a00f2e349b51e4cc9282a1a7b URL: https://github.com/llvm/llvm-project/commit/5f843693a461696a00f2e349b51e4cc9282a1a7b DIFF: https://github.com/llvm/llvm-project/commit/5f843693a461696a00f2e349b51e4cc9282a1a7b.diff LOG: [Clang] Convert CXX tests to opaque pointers (NFC) Added: Modified: clang/test/CXX/drs/dr158.cpp clang/test/CXX/except/except.spec/p14-ir.cpp clang/test/CXX/except/except.spec/p9-dynamic.cpp clang/test/CXX/except/except.spec/p9-noexcept.cpp clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks-irgen.mm clang/test/CXX/expr/p10-0x.cpp clang/test/CXX/special/class.copy/p15-inclass.cpp Removed: diff --git a/clang/test/CXX/drs/dr158.cpp b/clang/test/CXX/drs/dr158.cpp index 40603d4a4a05c..a0a8bd05baee3 100644 --- a/clang/test/CXX/drs/dr158.cpp +++ b/clang/test/CXX/drs/dr158.cpp @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s // dr158: yes // CHECK-LABEL: define {{.*}} @_Z1f const int *f(const int * const *p, int **q) { - // CHECK: load i32**, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]] + // CHECK: load ptr, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]] const int *x = *p; - // CHECK: store i32* null, {{.*}}, !tbaa ![[INTPTR_TBAA]] + // CHECK: store ptr null, {{.*}}, !tbaa ![[INTPTR_TBAA]] *q = 0; return x; } @@ -18,9 +18,9 @@ struct A {}; // CHECK-LABEL: define {{.*}} @_Z1g const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] { - // CHECK: load i64**, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]] + // CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]] const int *(A::*const *x)[3] = *p; - // CHECK: store i64* null, {{.*}}, !tbaa ![[MEMPTR_TBAA]] + // CHECK: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]] *q = 0; return x; } diff --git a/clang/test/CXX/except/except.spec/p14-ir.cpp b/clang/test/CXX/except/except.spec/p14-ir.cpp index 1406cd34ac4ce..48d0669ec641e 100644 --- a/clang/test/CXX/except/except.spec/p14-ir.cpp +++ b/clang/test/CXX/except/except.spec/p14-ir.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s // Copy constructor struct X0 { @@ -26,12 +26,12 @@ struct X4 { struct X5 : X0, X4 { }; void test(X2 x2, X3 x3, X5 x5) { - // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_(%struct.X2* {{[^,]*}} %this, %struct.X2* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr + // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr // CHECK: call void @_ZN2X2C2ERKS_({{.*}}) [[NUW:#[0-9]+]] // CHECK-NEXT: ret void // CHECK-NEXT: } X2 x2a(x2); - // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_(%struct.X3* {{[^,]*}} %this, %struct.X3* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr + // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr // CHECK: call void @_ZN2X3C2ERKS_({{.*}}) [[NUW]] // CHECK-NEXT: ret void // CHECK-NEXT: } @@ -55,25 +55,24 @@ struct X8 : X6 { }; struct X9 : X6, X7 { }; void test() { - // CHECK: define linkonce_odr void @_ZN2X8C1Ev(%struct.X8* {{[^,]*}} %this) unnamed_addr + // CHECK: define linkonce_odr void @_ZN2X8C1Ev(ptr {{[^,]*}} %this) unnamed_addr // CHECK: call void @_ZN2X8C2Ev({{.*}}) [[NUW]] // CHECK-NEXT: ret void X8(); - // CHECK: define linkonce_odr void @_ZN2X9C1Ev(%struct.X9* {{[^,]*}} %this) unnamed_addr + // CHECK: define linkonce_odr void
[clang] c9e9a7f - Revert "[Clang][NFC] Prevent lit tests from matching substrings in current path"
Author: Nikita Popov Date: 2022-12-12T14:44:10+01:00 New Revision: c9e9a7f2fd4b41a842c74ce2a4bbaccf8a4559e5 URL: https://github.com/llvm/llvm-project/commit/c9e9a7f2fd4b41a842c74ce2a4bbaccf8a4559e5 DIFF: https://github.com/llvm/llvm-project/commit/c9e9a7f2fd4b41a842c74ce2a4bbaccf8a4559e5.diff LOG: Revert "[Clang][NFC] Prevent lit tests from matching substrings in current path" This reverts commit bb48aa20e761e26226c6f909a07246781d68ba41. Using placeholders inside CHECK-LABEL is not legal. Added: Modified: clang/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp clang/test/CodeGenCXX/ignored-bitfield-conditional.cpp Removed: diff --git a/clang/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp b/clang/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp index 9bbf16f55fab4..0c9333fb6d7a0 100644 --- a/clang/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp +++ b/clang/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp @@ -1,11 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -// Catch the beginning and the end of the IR. This prevents the CHECK- from -// matching a spurious "constant" string in file paths printed later. - -// CHECK-LABEL: target triple // CHECK-NOT: constant -// CHECK-LABEL: attributes extern int X; const int Y = X; const int* foo() { return } diff --git a/clang/test/CodeGenCXX/ignored-bitfield-conditional.cpp b/clang/test/CodeGenCXX/ignored-bitfield-conditional.cpp index c9880f91a5178..7700e97ae9d5c 100644 --- a/clang/test/CodeGenCXX/ignored-bitfield-conditional.cpp +++ b/clang/test/CodeGenCXX/ignored-bitfield-conditional.cpp @@ -7,7 +7,7 @@ struct S { }; void use(bool cond, struct S s1, struct S s2, int val1, int val2) { - // CHECK-LABEL: define {{.*}}use{{.*}}( + // CHECK: define {{.*}}use{{.*}}( // CHECK: %[[S1:.+]] = alloca %struct.S // CHECK: %[[S2:.+]] = alloca %struct.S // CHECK: %[[COND:.+]] = alloca i8 @@ -43,7 +43,7 @@ void use(bool cond, struct S s1, struct S s2, int val1, int val2) { // CHECK: store i16 %[[BF_SET]], ptr %[[S1]] // CHECK: br label %[[END:.+]] - // CHECK-LABEL: [[END]]: + // CHECK: [[END]]: // There is nothing in the 'end' block associated with this, but it is the // 'continuation' block for the rest of the function. @@ -77,7 +77,7 @@ void use(bool cond, struct S s1, struct S s2, int val1, int val2) { // CHECK: store i16 %[[BF_SET]], ptr %[[S2]] // CHECK: br label %[[END:.+]] - // CHECK-LABEL: [[END]]: + // CHECK: [[END]]: // CHECK-NOT: phi // There is nothing in the 'end' block associated with this, but it is the // 'continuation' block for the rest of the function. @@ -86,7 +86,7 @@ void use(bool cond, struct S s1, struct S s2, int val1, int val2) { void use2(bool cond1, bool cond2, struct S s1, int val1, int val2, int val3) { - // CHECK-LABEL: define {{.*}}use2{{.*}}( + // CHECK: define {{.*}}use2{{.*}}( // CHECK: %[[S1:.+]] = alloca %struct.S // CHECK: %[[COND1:.+]] = alloca i8 // CHECK: %[[COND2:.+]] = alloca i8 @@ -141,10 +141,7 @@ void use2(bool cond1, bool cond2, struct S s1, int val1, int val2, int val3) { // CHECK: store i16 %[[BF_SET]], ptr %[[S1]] // CHECK: br label %[[END:.+]] - // CHECK-LABEL: [[END]]: + // CHECK[[END]]: // CHECK-NOT: phi // Nothing left to do here. } -// Catch the end of the IR. This prevents the CHECK-NOT above from matching a -// spurious "phi" in file paths printed later. -// CHECK-LABEL: attributes ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 6ebca03 - [Clang] Update test after wasm intrinsics attribute change (NFC)
Author: Nikita Popov Date: 2022-11-07T17:42:35+01:00 New Revision: 6ebca0302126c43ec8614d26aa444060e7a6da76 URL: https://github.com/llvm/llvm-project/commit/6ebca0302126c43ec8614d26aa444060e7a6da76 DIFF: https://github.com/llvm/llvm-project/commit/6ebca0302126c43ec8614d26aa444060e7a6da76.diff LOG: [Clang] Update test after wasm intrinsics attribute change (NFC) I missed this test in d35fcf0e97e7bb02381506a71e61ec282b292c50. Added: Modified: clang/test/CodeGenCXX/wasm-eh.cpp Removed: diff --git a/clang/test/CodeGenCXX/wasm-eh.cpp b/clang/test/CodeGenCXX/wasm-eh.cpp index e965768bf834f..27752f5f58036 100644 --- a/clang/test/CodeGenCXX/wasm-eh.cpp +++ b/clang/test/CodeGenCXX/wasm-eh.cpp @@ -34,7 +34,7 @@ void test0() { // CHECK-NEXT: %[[EXN:.*]] = call ptr @llvm.wasm.get.exception(token %[[CATCHPAD]]) // CHECK-NEXT: store ptr %[[EXN]], ptr %exn.slot // CHECK-NEXT: %[[SELECTOR:.*]] = call i32 @llvm.wasm.get.ehselector(token %[[CATCHPAD]]) -// CHECK-NEXT: %[[TYPEID:.*]] = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) #2 +// CHECK-NEXT: %[[TYPEID:.*]] = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) #8 // CHECK-NEXT: %[[MATCHES:.*]] = icmp eq i32 %[[SELECTOR]], %[[TYPEID]] // CHECK-NEXT: br i1 %[[MATCHES]], label %[[CATCH_INT_BB:.*]], label %[[CATCH_FALLTHROUGH_BB:.*]] @@ -51,7 +51,7 @@ void test0() { // CHECK-NEXT: br label %[[TRY_CONT_BB:.*]] // CHECK: [[CATCH_FALLTHROUGH_BB]] -// CHECK-NEXT: %[[TYPEID:.*]] = call i32 @llvm.eh.typeid.for(ptr @_ZTId) #2 +// CHECK-NEXT: %[[TYPEID:.*]] = call i32 @llvm.eh.typeid.for(ptr @_ZTId) #8 // CHECK-NEXT: %[[MATCHES:.*]] = icmp eq i32 %[[SELECTOR]], %[[TYPEID]] // CHECK-NEXT: br i1 %[[MATCHES]], label %[[CATCH_FLOAT_BB:.*]], label %[[RETHROW_BB:.*]] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0cbf003 - [PowerPC] Fix check for ieeelongdouble support
Author: Nikita Popov Date: 2022-10-27T10:36:37+02:00 New Revision: 0cbf003c78cdba5cc81b69ee4cd6cee53f2e2796 URL: https://github.com/llvm/llvm-project/commit/0cbf003c78cdba5cc81b69ee4cd6cee53f2e2796 DIFF: https://github.com/llvm/llvm-project/commit/0cbf003c78cdba5cc81b69ee4cd6cee53f2e2796.diff LOG: [PowerPC] Fix check for ieeelongdouble support Clang detects the GCC version from the libdir. However, modern GCC versions only include the major version in the libdir (something like lib/gcc/powerpc64le-linux-gnu/12/), not all version components. For this reason, even though the system has a supported libstdcxx, it will still fail the check against the 12.1.0 version requirement. Fix this by doing the same thing we do for patch versions: Assume that a missing minor version is larger than any specific version. To allow this to be tested, we need to fix two additional issues: First, the GCC toolchain directories used for testing need to contain a crtbegin.o file to be properly detected. The existing tests actually ended up using a 0.0.0 version, rather the intended one. Second, we also need to satisfy the glibc version check based on the dynamic linker. To do so, respect the --dyld-prefix argument and add the necessary file to the test toolchain directory. Differential Revision: https://reviews.llvm.org/D136258 Added: clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/crtbegin.o clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib/gcc/powerpc64le-linux-gnu/12/crtbegin.o clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib64/ld64.so.2 Modified: clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/PPCLinux.cpp clang/test/Driver/ppc-float-abi-warning.cpp Removed: clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/.keep diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index e592b7394d0b2..668a4498e8075 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -1884,8 +1884,15 @@ bool Generic_GCC::GCCVersion::isOlderThan(int RHSMajor, int RHSMinor, StringRef RHSPatchSuffix) const { if (Major != RHSMajor) return Major < RHSMajor; - if (Minor != RHSMinor) + if (Minor != RHSMinor) { +// Note that versions without a specified minor sort higher than those with +// a minor. +if (RHSMinor == -1) + return true; +if (Minor == -1) + return false; return Minor < RHSMinor; + } if (Patch != RHSPatch) { // Note that versions without a specified patch sort higher than those with // a patch. diff --git a/clang/lib/Driver/ToolChains/PPCLinux.cpp b/clang/lib/Driver/ToolChains/PPCLinux.cpp index 2fea262fd109c..de9c2955a3848 100644 --- a/clang/lib/Driver/ToolChains/PPCLinux.cpp +++ b/clang/lib/Driver/ToolChains/PPCLinux.cpp @@ -82,6 +82,7 @@ bool PPCLinuxToolChain::SupportIEEEFloat128( (StdLib == CST_Libstdcxx && GCCInstallation.getVersion().isOlderThan(12, 1, 0)); - return GlibcSupportsFloat128(Linux::getDynamicLinker(Args)) && + std::string Linker = Linux::getDynamicLinker(Args); + return GlibcSupportsFloat128((Twine(D.DyldPrefix) + Linker).str()) && !(D.CCCIsCXX() && HasUnsupportedCXXLib); } diff --git a/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/.keep b/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/crtbegin.o similarity index 100% rename from clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/.keep rename to clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/crtbegin.o diff --git a/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib/gcc/powerpc64le-linux-gnu/12/crtbegin.o b/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib/gcc/powerpc64le-linux-gnu/12/crtbegin.o new file mode 100644 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib64/ld64.so.2 b/clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-12/lib64/ld64.so.2 new file mode 100644 index 0..e69de29bb2d1d diff --git a/clang/test/Driver/ppc-float-abi-warning.cpp b/clang/test/Driver/ppc-float-abi-warning.cpp index 3ccb9415a021d..729a3070396fb 100644 --- a/clang/test/Driver/ppc-float-abi-warning.cpp +++ b/clang/test/Driver/ppc-float-abi-warning.cpp @@ -3,6 +3,11 @@ // RUN: --gcc-toolchain=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0 \ // RUN: -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | FileCheck %s // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \ +// RUN:
[clang] 6ce8727 - [cmake] Remove LLVM_INCLUDE_GO_TESTS variable
Author: Nikita Popov Date: 2022-10-14T16:34:36+02:00 New Revision: 6ce87272487711c9f0ff408a037f5ca2e1ff5c5d URL: https://github.com/llvm/llvm-project/commit/6ce87272487711c9f0ff408a037f5ca2e1ff5c5d DIFF: https://github.com/llvm/llvm-project/commit/6ce87272487711c9f0ff408a037f5ca2e1ff5c5d.diff LOG: [cmake] Remove LLVM_INCLUDE_GO_TESTS variable As pointed out by thakis in https://reviews.llvm.org/D135436#3858463, this variable can be dropped now that the Go bindings have been removed. Added: Modified: clang/cmake/caches/Fuchsia-stage2.cmake clang/cmake/caches/Fuchsia.cmake llvm/CMakeLists.txt llvm/test/CMakeLists.txt llvm/test/lit.site.cfg.py.in Removed: diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake index d0bdeb3249797..7a09e4798309e 100644 --- a/clang/cmake/caches/Fuchsia-stage2.cmake +++ b/clang/cmake/caches/Fuchsia-stage2.cmake @@ -21,7 +21,6 @@ set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") set(LLVM_ENABLE_ZLIB ON CACHE BOOL "") set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") -set(LLVM_INCLUDE_GO_TESTS OFF CACHE BOOL "") set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "") set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "") diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake index 1978195c267d9..7537bf8a3ee2b 100644 --- a/clang/cmake/caches/Fuchsia.cmake +++ b/clang/cmake/caches/Fuchsia.cmake @@ -16,7 +16,6 @@ set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") -set(LLVM_INCLUDE_GO_TESTS OFF CACHE BOOL "") if(WIN32) set(LLVM_USE_CRT_RELEASE "MT" CACHE STRING "") diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index d5925f9ae6a82..5b493a7ebad55 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -702,7 +702,6 @@ endif(LLVM_BUILD_EXAMPLES) option(LLVM_BUILD_TESTS "Build LLVM unit tests. If OFF, just generate build targets." OFF) option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) -option(LLVM_INCLUDE_GO_TESTS "Include the Go bindings tests in test build targets." OFF) option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default targets. If OFF, benchmarks still could be built using Benchmarks target." OFF) diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt index d98908c4f05bc..a38fb0a2408d4 100644 --- a/llvm/test/CMakeLists.txt +++ b/llvm/test/CMakeLists.txt @@ -10,7 +10,6 @@ llvm_canonicalize_cmake_booleans( LLVM_ENABLE_ZLIB LLVM_ENABLE_ZSTD LLVM_ENABLE_LIBXML2 - LLVM_INCLUDE_GO_TESTS LLVM_LINK_LLVM_DYLIB LLVM_TOOL_LTO_BUILD LLVM_USE_INTEL_JITEVENTS diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in index 63cfddaa93087..5531732e16bc3 100644 --- a/llvm/test/lit.site.cfg.py.in +++ b/llvm/test/lit.site.cfg.py.in @@ -21,7 +21,6 @@ config.osx_sysroot = path(r"@CMAKE_OSX_SYSROOT@") config.ocamlfind_executable = "@OCAMLFIND@" config.have_ocamlopt = @HAVE_OCAMLOPT@ config.ocaml_flags = "@OCAMLFLAGS@" -config.include_go_tests = @LLVM_INCLUDE_GO_TESTS@ config.ptxas_executable = "@PTXAS_EXECUTABLE@" config.enable_shared = @ENABLE_SHARED@ config.enable_assertions = @ENABLE_ASSERTIONS@ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 01bbe87 - [CGStmt] Use helper functions to set memory attributes (NFC)
Author: Nikita Popov Date: 2022-10-12T16:38:39+02:00 New Revision: 01bbe87fbb66cad9193c97843b0dd20aa2bd24ae URL: https://github.com/llvm/llvm-project/commit/01bbe87fbb66cad9193c97843b0dd20aa2bd24ae DIFF: https://github.com/llvm/llvm-project/commit/01bbe87fbb66cad9193c97843b0dd20aa2bd24ae.diff LOG: [CGStmt] Use helper functions to set memory attributes (NFC) Added: Modified: clang/lib/CodeGen/CGStmt.cpp Removed: diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index ebbc79cc8b4b6..30c955b3d43fd 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -2280,9 +2280,9 @@ static void UpdateAsmCallInst(llvm::CallBase , bool HasSideEffect, // Attach readnone and readonly attributes. if (!HasSideEffect) { if (ReadNone) - Result.addFnAttr(llvm::Attribute::ReadNone); + Result.setDoesNotAccessMemory(); else if (ReadOnly) - Result.addFnAttr(llvm::Attribute::ReadOnly); + Result.setOnlyReadsMemory(); } // Add elementtype attribute for indirect constraints. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 956f7f2 - [CodeGenCXX] Remove typed pointer check lines from test (NFC)
Author: Nikita Popov Date: 2022-10-06T13:06:02+02:00 New Revision: 956f7f2b4f785271f7fde2a6ff83472d9451968f URL: https://github.com/llvm/llvm-project/commit/956f7f2b4f785271f7fde2a6ff83472d9451968f DIFF: https://github.com/llvm/llvm-project/commit/956f7f2b4f785271f7fde2a6ff83472d9451968f.diff LOG: [CodeGenCXX] Remove typed pointer check lines from test (NFC) This test already has check lines for opaque pointers, remove the unnecessary typed pointer check lines. Added: Modified: clang/test/CodeGenCXX/threadlocal_address.cpp Removed: diff --git a/clang/test/CodeGenCXX/threadlocal_address.cpp b/clang/test/CodeGenCXX/threadlocal_address.cpp index f5af5c25facd..cb63bc275990 100644 --- a/clang/test/CodeGenCXX/threadlocal_address.cpp +++ b/clang/test/CodeGenCXX/threadlocal_address.cpp @@ -1,7 +1,6 @@ // Test that the use of thread local variables would be wrapped by @llvm.threadlocal.address intrinsics. // RUN: %clang_cc1 -std=c++11 -emit-llvm -triple x86_64 -o - %s -disable-llvm-passes | FileCheck %s // RUN: %clang_cc1 -std=c++11 -emit-llvm -triple aarch64 -o - -O1 %s | FileCheck %s -check-prefix=CHECK-O1 -// RUN: %clang_cc1 -std=c++11 -no-opaque-pointers -emit-llvm -triple x86_64 -o - %s -disable-llvm-passes | FileCheck %s -check-prefix=CHECK-NOOPAQUE thread_local int i; int g() { i++; @@ -29,16 +28,6 @@ int g() { // CHECK-O1-NEXT: %[[INC:.+]] = add nsw i32 %[[VAL]], 1 // CHECK-O1-NEXT: store i32 %[[INC]], ptr %[[I_ADDR]] // CHECK-O1-NEXT: ret i32 %[[INC]] -// -// CHECK-NOOPAQUE-LABEL: @_Z1gv -// CHECK-NOOPAQUE-NEXT: entry: -// CHECK-NOOPAQUE-NEXT: %[[I_ADDR:.+]] = call align 4 i32* @llvm.threadlocal.address.p0i32(i32* align 4 @i) -// CHECK-NOOPAQUE-NEXT: %[[VAL:.+]] = load i32, i32* %[[I_ADDR]] -// CHECK-NOOPAQUE-NEXT: %[[INC:.+]] = add nsw i32 %[[VAL]], 1 -// CHECK-NOOPAQUE-NEXT: store i32 %[[INC]], i32* %[[I_ADDR]] -// CHECK-NOOPAQUE-NEXT: %[[IA2:.+]] = call align 4 i32* @llvm.threadlocal.address.p0i32(i32* align 4 @i) -// CHECK-NOOPAQUE-NEXT: %[[RET:.+]] = load i32, i32* %[[IA2]], align 4 -// CHECK-NOOPAQUE-NEXT: ret i32 %[[RET]] int f() { thread_local int j = 0; j++; @@ -62,14 +51,4 @@ int f() { // CHECK-O1-NEXT: store i32 %[[INC]], ptr %[[J_ADDR]] // CHECK-O1-NEXT: ret i32 %[[INC]] // -// CHECK-NOOPAQUE: @_Z1fv() -// CHECK-NOOPAQUE-NEXT: entry -// CHECK-NOOPAQUE-NEXT: %[[JA:.+]] = call align 4 i32* @llvm.threadlocal.address.p0i32(i32* align 4 @_ZZ1fvE1j) -// CHECK-NOOPAQUE-NEXT: %[[VA:.+]] = load i32, i32* %[[JA]] -// CHECK-NOOPAQUE-NEXT: %[[INC:.+]] = add nsw i32 %[[VA]], 1 -// CHECK-NOOPAQUE-NEXT: store i32 %[[INC]], i32* %[[JA]], align 4 -// CHECK-NOOPAQUE-NEXT: %[[JA2:.+]] = call align 4 i32* @llvm.threadlocal.address.p0i32(i32* align 4 @_ZZ1fvE1j) -// CHECK-NOOPAQUE-NEXT: %[[RET:.+]] = load i32, i32* %[[JA2]], align 4 -// CHECK-NOOPAQUE-NEXT: ret i32 %[[RET]] -// // CHECK: attributes #[[ATTR_NUM]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 89810ce - [RelativeVTablesABI] Convert tests to opaque pointers (NFC)
Author: Nikita Popov Date: 2022-10-06T12:37:42+02:00 New Revision: 89810cee544db09fbf7d578c6e93db7a9cb0d9e5 URL: https://github.com/llvm/llvm-project/commit/89810cee544db09fbf7d578c6e93db7a9cb0d9e5 DIFF: https://github.com/llvm/llvm-project/commit/89810cee544db09fbf7d578c6e93db7a9cb0d9e5.diff LOG: [RelativeVTablesABI] Convert tests to opaque pointers (NFC) Converted using https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34 with manual fixup, primarily to drop check lines for types that no longer appear with opaque pointers. Added: Modified: clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp clang/test/CodeGenCXX/RelativeVTablesABI/diamond-virtual-inheritance.cpp clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp clang/test/CodeGenCXX/RelativeVTablesABI/multiple-inheritance.cpp clang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp clang/test/CodeGenCXX/RelativeVTablesABI/vbase-offset.cpp clang/test/CodeGenCXX/RelativeVTablesABI/virtual-function-call.cpp Removed: diff --git a/clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp b/clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp index 6990a068b5ab..cd3ce22fc8e9 100644 --- a/clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp +++ b/clang/test/CodeGenCXX/RelativeVTablesABI/diamond-inheritance.cpp @@ -1,28 +1,23 @@ // Diamond inheritance. // A more complicated multiple inheritance example that includes longer chain of inheritance and a common ancestor. -// RUN: %clang_cc1 -no-opaque-pointers %s -triple=aarch64-unknown-fuchsia -O1 -S -o - -emit-llvm -fhalf-no-semantic-interposition | FileCheck %s - -// CHECK-DAG: %class.B = type { %class.A } -// CHECK-DAG: %class.A = type { i32 (...)** } -// CHECK-DAG: %class.C = type { %class.A } -// CHECK-DAG: %class.D = type { %class.B, %class.C } +// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O1 -S -o - -emit-llvm -fhalf-no-semantic-interposition | FileCheck %s // VTable for B should contain offset to top (0), RTTI pointer, A::foo(), and B::barB(). -// CHECK: @_ZTV1B.local = private unnamed_addr constant { [4 x i32] } { [4 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint ({ i8*, i8*, i8* }** @_ZTI1B.rtti_proxy to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.A*)* dso_local_equivalent @_ZN1A3fooEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.B*)* dso_local_equivalent @_ZN1B4barBEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32)] }, align 4 +// CHECK: @_ZTV1B.local = private unnamed_addr constant { [4 x i32] } { [4 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint (ptr @_ZTI1B.rtti_proxy to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32] }, ptr @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1A3fooEv to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32] }, ptr @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1B4barBEv to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32] }, ptr @_ZTV1B.local, i32 0, i32 0, i32 2) to i64)) to i32)] }, align 4 // VTable for C should contain offset to top (0), RTTI pointer, A::foo(), and C::barC(). -// CHECK: @_ZTV1C.local = private unnamed_addr constant { [4 x i32] } { [4 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint ({ i8*, i8*, i8* }** @_ZTI1C.rtti_proxy to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1C.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.A*)* dso_local_equivalent @_ZN1A3fooEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1C.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (void (%class.C*)* dso_local_equivalent @_ZN1C4barCEv to i64), i64 ptrtoint (i32* getelementptr inbounds ({ [4 x i32] }, { [4 x i32] }* @_ZTV1C.local, i32 0, i32 0, i32 2) to i64)) to i32)] }, align 4 +// CHECK: @_ZTV1C.local = private unnamed_addr constant { [4 x i32] } { [4 x i32] [i32 0, i32 trunc (i64 sub (i64 ptrtoint (ptr @_ZTI1C.rtti_proxy to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32] }, ptr @_ZTV1C.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1A3fooEv to i64), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32] }, ptr @_ZTV1C.local, i32 0, i32 0, i32 2) to i64)) to i32), i32 trunc (i64 sub (i64
[clang] d785a8e - [clang] Remove CLANG_ENABLE_OPAQUE_POINTERS cmake option
Author: Nikita Popov Date: 2022-10-06T09:46:04+02:00 New Revision: d785a8eaa25dd1110dc7b24b16d3b21c9c179837 URL: https://github.com/llvm/llvm-project/commit/d785a8eaa25dd1110dc7b24b16d3b21c9c179837 DIFF: https://github.com/llvm/llvm-project/commit/d785a8eaa25dd1110dc7b24b16d3b21c9c179837.diff LOG: [clang] Remove CLANG_ENABLE_OPAQUE_POINTERS cmake option Remove the ability to disable opaque pointers by default in clang. It is still possible to explicitly disable them via cc1 -no-opaque-pointers. Differential Revision: https://reviews.llvm.org/D135259 Added: Modified: clang/CMakeLists.txt clang/include/clang/Config/config.h.cmake clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/CMakeLists.txt clang/test/lit.cfg.py clang/test/lit.site.cfg.py.in Removed: clang/test/Driver/lto-no-opaque-pointers.c clang/test/Driver/lto-opaque-pointers.c clang/test/Driver/opaque-pointers-off.c diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f43fa51a3379c..875bd27e13206 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -189,17 +189,6 @@ set(CLANG_SPAWN_CC1 OFF CACHE BOOL option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON) -# Manually handle default so we can change the meaning of a cached default. -set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING -"Enable opaque pointers by default") -if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT") - set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) -elseif(CLANG_ENABLE_OPAQUE_POINTERS) - set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) -else() - set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF) -endif() - # TODO: verify the values against LangStandards.def? set(CLANG_DEFAULT_STD_C "" CACHE STRING "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)") diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake index a4083827e43f8..3ffc2a12a89fe 100644 --- a/clang/include/clang/Config/config.h.cmake +++ b/clang/include/clang/Config/config.h.cmake @@ -101,7 +101,4 @@ /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */ #cmakedefine01 CLANG_SPAWN_CC1 -/* Whether to enable opaque pointers by default */ -#cmakedefine01 CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL - #endif diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index e5fce35793598..4f880c27b2f11 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6697,9 +6697,6 @@ void Clang::ConstructJob(Compilation , const JobAction , false)) CmdArgs.push_back("-fmodules-debuginfo"); - if (!CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL) -CmdArgs.push_back("-no-opaque-pointers"); - ObjCRuntime Runtime = AddObjCRuntimeArgs(Args, Inputs, CmdArgs, rewriteKind); RenderObjCOptions(TC, D, RawTriple, Args, Runtime, rewriteKind != RK_None, Input, CmdArgs); diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index d81faa3652285..7f20122722365 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -558,9 +558,6 @@ void tools::addLTOOptions(const ToolChain , const ArgList , CmdArgs.push_back( Args.MakeArgString("-plugin-opt=jobs=" + Twine(Parallelism))); - if (!CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL) -CmdArgs.push_back(Args.MakeArgString("-plugin-opt=no-opaque-pointers")); - // If an explicit debugger tuning argument appeared, pass it along. if (Arg *A = Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) { diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index c3dcc53b78ab5..09394a0f7f730 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -5,7 +5,6 @@ llvm_canonicalize_cmake_booleans( CLANG_BUILD_EXAMPLES CLANG_BUILT_STANDALONE CLANG_DEFAULT_PIE_ON_LINUX - CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL CLANG_ENABLE_ARCMT CLANG_ENABLE_STATIC_ANALYZER CLANG_PLUGIN_SUPPORT diff --git a/clang/test/Driver/lto-no-opaque-pointers.c b/clang/test/Driver/lto-no-opaque-pointers.c deleted file mode 100644 index 9146ae5da5824..0 --- a/clang/test/Driver/lto-no-opaque-pointers.c +++ /dev/null @@ -1,5 +0,0 @@ -// UNSUPPORTED: enable-opaque-pointers -// RUN: %clang --target=x86_64-unknown-linux -### %s -flto 2> %t -// RUN: FileCheck %s < %t - -// CHECK: -plugin-opt=no-opaque-pointers diff --git a/clang/test/Driver/lto-opaque-pointers.c b/clang/test/Driver/lto-opaque-pointers.c deleted file mode 100644 index acdf13c21fd41..0 --- a/clang/test/Driver/lto-opaque-pointers.c +++ /dev/null @@ -1,5 +0,0 @@ -// REQUIRES:
[clang] fd24750 - Revert "C++/ObjC++: switch to gnu++17 as the default standard"
Author: Nikita Popov Date: 2022-09-08T09:45:50+02:00 New Revision: fd2475049e882e6c70a745cbe0799749ba184910 URL: https://github.com/llvm/llvm-project/commit/fd2475049e882e6c70a745cbe0799749ba184910 DIFF: https://github.com/llvm/llvm-project/commit/fd2475049e882e6c70a745cbe0799749ba184910.diff LOG: Revert "C++/ObjC++: switch to gnu++17 as the default standard" This reverts commit e321c8dd2cea8365045ed44ae1c3c00c6a977d2e. This causes many failures in llvm-test-suite, for example: /home/npopov/repos/llvm-test-suite/build-O3/tools/timeit --summary MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o.time /home/npopov/repos/llvm-project/build/bin/clang++ -DNDEBUG -I/home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3 -O3 -w -Werror=date-time -MD -MT MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o -MF MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o.d -o MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o -c /home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3/token_stream.cc /home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3/token_stream.cc:192:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] register char chr; ^ Added: clang/test/Preprocessor/lang-std.cu Modified: clang/docs/ReleaseNotes.rst clang/lib/Basic/LangStandards.cpp clang/test/lit.cfg.py clang/test/lit.site.cfg.py.in Removed: clang/test/Preprocessor/lang-std.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 425135d746b99..b370d23856c21 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -200,10 +200,6 @@ C++ Language Changes in Clang - Implemented DR692, DR1395 and DR1432. Use the ``-fclang-abi-compat=15`` option to get the old partial ordering behavior regarding packs. -- Clang's default C++/ObjC++ standard is now ``gnu++17`` instead of ``gnu++14``. - This means Clang will by default accept code using features from C++17 and - conforming GNU extensions. Projects incompatible with C++17 can add - ``-std=gnu++14`` to their build settings to restore the previous behaviour. C++20 Feature Support ^ diff --git a/clang/lib/Basic/LangStandards.cpp b/clang/lib/Basic/LangStandards.cpp index 92e8ab347dda1..a21898dd3c627 100644 --- a/clang/lib/Basic/LangStandards.cpp +++ b/clang/lib/Basic/LangStandards.cpp @@ -75,9 +75,10 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang, if (CLANG_DEFAULT_STD_CXX != LangStandard::lang_unspecified) return CLANG_DEFAULT_STD_CXX; -if (T.isPS()) +if (T.isDriverKit()) + return LangStandard::lang_gnucxx17; +else return LangStandard::lang_gnucxx14; -return LangStandard::lang_gnucxx17; case Language::RenderScript: return LangStandard::lang_c99; case Language::HIP: diff --git a/clang/test/Preprocessor/lang-std.cpp b/clang/test/Preprocessor/lang-std.cpp deleted file mode 100644 index 538f1b1976dad..0 --- a/clang/test/Preprocessor/lang-std.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// UNSUPPORTED: default-std-cxx, ps4, ps5 -/// Test default standards when CLANG_DEFAULT_STD_CXX is unspecified. -/// PS4/PS5 default to gnu++14. - -// RUN: %clang_cc1 -dM -E %s | FileCheck --check-prefix=CXX17 %s -// RUN: %clang_cc1 -dM -E -x cuda %s | FileCheck --check-prefix=CXX14 %s -// RUN: %clang_cc1 -dM -E -x hip %s | FileCheck --check-prefix=CXX14 %s - -// RUN: %clang_cc1 -dM -E -x cuda -std=c++14 %s | FileCheck --check-prefix=CXX14 %s -// RUN: %clang_cc1 -dM -E -x hip -std=c++98 %s | FileCheck --check-prefix=CXX98 %s - -// CXX98: #define __cplusplus 199711L -// CXX14: #define __cplusplus 201402L -// CXX17: #define __cplusplus 201703L diff --git a/clang/test/Preprocessor/lang-std.cu b/clang/test/Preprocessor/lang-std.cu new file mode 100644 index 0..4f35af01aaf5f --- /dev/null +++ b/clang/test/Preprocessor/lang-std.cu @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -dM -E -x hip %s | FileCheck -check-prefix=CXX14 %s +// RUN: %clang_cc1 -dM -E %s | FileCheck -check-prefix=CXX14 %s +// RUN: %clang_cc1 -dM -E -std=c++98 -x hip %s | FileCheck -check-prefix=CXX98 %s +// RUN: %clang_cc1 -dM -E -std=c++98 %s | FileCheck -check-prefix=CXX98 %s + +// CXX98: #define __cplusplus 199711L +// CXX14: #define __cplusplus 201402L diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py index 7fa46e3d99fca..792216595d3fe 100644 --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -131,9 +131,6 @@ def have_host_jit_feature_support(feature_name): if config.clang_enable_opaque_pointers: config.available_features.add('enable-opaque-pointers') -if config.clang_default_std_cxx != '': -
[clang] 98a3a34 - [ConstantExpr] Don't create fneg expressions
Author: Nikita Popov Date: 2022-09-07T11:27:25+02:00 New Revision: 98a3a340c3612c06c51d7bb36bfc5857ab06a951 URL: https://github.com/llvm/llvm-project/commit/98a3a340c3612c06c51d7bb36bfc5857ab06a951 DIFF: https://github.com/llvm/llvm-project/commit/98a3a340c3612c06c51d7bb36bfc5857ab06a951.diff LOG: [ConstantExpr] Don't create fneg expressions Don't create fneg expressions unless explicitly requested by IR or bitcode. Added: Modified: clang/test/CodeGen/constantexpr-fneg.c llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/IR/ConstantFolder.h llvm/lib/Analysis/ConstantFolding.cpp llvm/test/Transforms/InstCombine/fmul.ll llvm/test/Transforms/InstCombine/fneg.ll llvm/test/Transforms/Reassociate/crash2.ll Removed: diff --git a/clang/test/CodeGen/constantexpr-fneg.c b/clang/test/CodeGen/constantexpr-fneg.c index 17873345daee7..7fc78cfebf8f3 100644 --- a/clang/test/CodeGen/constantexpr-fneg.c +++ b/clang/test/CodeGen/constantexpr-fneg.c @@ -2,8 +2,7 @@ // RUN: llvm-dis %t.bc -o - | FileCheck %s // Test case for PR45426. Make sure we do not crash while writing bitcode -// containing a simplify-able fneg constant expression. Check that the created -// bitcode file can be disassembled and has the constant expressions simplified. +// containing a simplify-able fneg constant expression. // // CHECK-LABEL define i32 @main() // CHECK: entry: @@ -11,7 +10,9 @@ // CHECK-NEXT: store i32 0, i32* %retval // CHECK-NEXT: [[LV:%.*]] = load float*, float** @c // CHECK-NEXT: store float 1.00e+00, float* [[LV]], align 4 -// CHECK-NEXT: ret i32 -1 +// CHECK-NEXT: [[FNEG:%.*]] = fneg float 1.00e+00 +// CHECK-NEXT: [[CONV:%.*]] = fptosi float [[FNEG]] to i32 +// CHECK-NEXT: ret i32 [[CONV]] int a[], b; float *c; diff --git a/llvm/include/llvm/Analysis/TargetFolder.h b/llvm/include/llvm/Analysis/TargetFolder.h index c42577330e9b4..db7eda54b5c45 100644 --- a/llvm/include/llvm/Analysis/TargetFolder.h +++ b/llvm/include/llvm/Analysis/TargetFolder.h @@ -110,7 +110,7 @@ class TargetFolder final : public IRBuilderFolder { Value *FoldUnOpFMF(Instruction::UnaryOps Opc, Value *V, FastMathFlags FMF) const override { if (Constant *C = dyn_cast(V)) - return Fold(ConstantExpr::get(Opc, C)); + return ConstantFoldUnaryOpOperand(Opc, C, DL); return nullptr; } diff --git a/llvm/include/llvm/IR/ConstantFolder.h b/llvm/include/llvm/IR/ConstantFolder.h index bd28ff87965dd..82c07d47a1930 100644 --- a/llvm/include/llvm/IR/ConstantFolder.h +++ b/llvm/include/llvm/IR/ConstantFolder.h @@ -91,7 +91,7 @@ class ConstantFolder final : public IRBuilderFolder { Value *FoldUnOpFMF(Instruction::UnaryOps Opc, Value *V, FastMathFlags FMF) const override { if (Constant *C = dyn_cast(V)) - return ConstantExpr::get(Opc, C); + return ConstantFoldUnaryInstruction(Opc, C); return nullptr; } diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 9187d49ca7a5a..df1a9bfa3da27 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1333,7 +1333,7 @@ Constant *llvm::ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, const DataLayout ) { assert(Instruction::isUnaryOp(Opcode)); - return ConstantExpr::get(Opcode, Op); + return ConstantFoldUnaryInstruction(Opcode, Op); } Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, diff --git a/llvm/test/Transforms/InstCombine/fmul.ll b/llvm/test/Transforms/InstCombine/fmul.ll index 10c8bdd532817..981e26c4912bf 100644 --- a/llvm/test/Transforms/InstCombine/fmul.ll +++ b/llvm/test/Transforms/InstCombine/fmul.ll @@ -1057,7 +1057,8 @@ define float @fmul_fdiv_factor_extra_use(float %x, float %y) { define double @fmul_negated_constant_expression(double %x) { ; CHECK-LABEL: @fmul_negated_constant_expression( -; CHECK-NEXT:[[R:%.*]] = fmul double [[X:%.*]], fneg (double bitcast (i64 ptrtoint (i8** getelementptr inbounds ({ [2 x i8*] }, { [2 x i8*] }* @g, i64 0, inrange i32 0, i64 2) to i64) to double)) +; CHECK-NEXT:[[FSUB:%.*]] = fneg double bitcast (i64 ptrtoint (i8** getelementptr inbounds ({ [2 x i8*] }, { [2 x i8*] }* @g, i64 0, inrange i32 0, i64 2) to i64) to double) +; CHECK-NEXT:[[R:%.*]] = fmul double [[FSUB]], [[X:%.*]] ; CHECK-NEXT:ret double [[R]] ; %fsub = fsub double -0.00e+00, bitcast (i64 ptrtoint (i8** getelementptr inbounds ({ [2 x i8*] }, { [2 x i8*] }* @g, i64 0, inrange i32 0, i64 2) to i64) to double) diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll index c08ac44e34130..08ced4018483b 100644 --- a/llvm/test/Transforms/InstCombine/fneg.ll +++
[clang] 7179779 - [OpenMP] Mark -fopenmp-implicit-rpath as NoArgumentUnused
Author: Nikita Popov Date: 2022-09-06T09:44:45+02:00 New Revision: 71797797f7a759245cb39b93307e0641c511170c URL: https://github.com/llvm/llvm-project/commit/71797797f7a759245cb39b93307e0641c511170c DIFF: https://github.com/llvm/llvm-project/commit/71797797f7a759245cb39b93307e0641c511170c.diff LOG: [OpenMP] Mark -fopenmp-implicit-rpath as NoArgumentUnused This matches the behavior for all the other -fopenmp options, as well as -frtlib-add-rpath. For context, Fedora passes this flag by default in case OpenMP is used, and this results in a warning if it (usually) isn't, which causes build failures for some programs with unnecessarily strict build systems (like Ruby). Differential Revision: https://reviews.llvm.org/D133316 Added: Modified: clang/include/clang/Driver/Options.td Removed: diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index c7c34f072ba23..58a316b0180e6 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4114,7 +4114,8 @@ defm openmp_implicit_rpath: BoolFOption<"openmp-implicit-rpath", LangOpts<"OpenMP">, DefaultTrue, PosFlag, - NegFlag>; + NegFlag, + BothFlags<[NoArgumentUnused]>>; def r : Flag<["-"], "r">, Flags<[LinkerInput,NoArgumentUnused]>, Group; def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[CC1Option, FlangOption, NoXarchOption]>, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] a11e2d7 - [libclc] Quote addition of CLC/LLAsm flags
Author: Nikita Popov Date: 2022-08-31T11:10:24+02:00 New Revision: a11e2d7366a11385e23d142ac93065a861b70a16 URL: https://github.com/llvm/llvm-project/commit/a11e2d7366a11385e23d142ac93065a861b70a16 DIFF: https://github.com/llvm/llvm-project/commit/a11e2d7366a11385e23d142ac93065a861b70a16.diff LOG: [libclc] Quote addition of CLC/LLAsm flags Otherwise cmake will insert a semicolon if flags are already set. Differential Revision: https://reviews.llvm.org/D131490 Added: Modified: libclc/CMakeLists.txt Removed: diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 9773b2cc925ff..96519e09e28e4 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -136,8 +136,8 @@ set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_MAJOR}0${LLVM_MINOR}" ) # LLVM 13 enables standard includes by default if( ${LLVM_VERSION} VERSION_GREATER "12.99.99" ) - set( CMAKE_LLAsm_FLAGS ${CMAKE_LLAsm_FLAGS} -cl-no-stdinc ) - set( CMAKE_CLC_FLAGS ${CMAKE_CLC_FLAGS} -cl-no-stdinc ) + set( CMAKE_LLAsm_FLAGS "${CMAKE_LLAsm_FLAGS} -cl-no-stdinc") + set( CMAKE_CLC_FLAGS "${CMAKE_CLC_FLAGS} -cl-no-stdinc") endif() enable_language( CLC LLAsm ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c04eab8 - [Flang] Use find_program() to find clang-tblgen
Author: Nikita Popov Date: 2022-08-29T11:09:25+02:00 New Revision: c04eab8c78e517210c7641551ec008b09bfe20d0 URL: https://github.com/llvm/llvm-project/commit/c04eab8c78e517210c7641551ec008b09bfe20d0 DIFF: https://github.com/llvm/llvm-project/commit/c04eab8c78e517210c7641551ec008b09bfe20d0.diff LOG: [Flang] Use find_program() to find clang-tblgen There are two scenarios here: 1. Standalone flang build, where we use an installed clang-tblgen binary. We need to use find_package() to find it. 2. Combined build of clang and flang, where we want to use the path specified in CLANG_TABLEGEN_EXE during the clang build -- however, this variable was previously not exported. The new implementation matches what is done for mlir-tblgen. Differential Revision: https://reviews.llvm.org/D131475 Added: Modified: clang/CMakeLists.txt flang/docs/CMakeLists.txt Removed: diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 2b1e968da3960..1064cfd0a35a3 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -484,6 +484,9 @@ option(CLANG_INCLUDE_TESTS add_subdirectory(utils/TableGen) +# Export CLANG_TABLEGEN_EXE for use by flang docs. +set(CLANG_TABLEGEN_EXE "${CLANG_TABLEGEN_EXE}" CACHE INTERNAL "") + add_subdirectory(include) # All targets below may depend on all tablegen'd files. diff --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt index 770343cd29b80..3414b8e3acc46 100644 --- a/flang/docs/CMakeLists.txt +++ b/flang/docs/CMakeLists.txt @@ -126,7 +126,7 @@ if (LLVM_ENABLE_SPHINX) ARGS ${CMAKE_CURRENT_BINARY_DIR}/Source/FIR/CreateFIRLangRef.py) # CLANG_TABLEGEN_EXE variable needs to be set for clang_tablegen to run without error - set(CLANG_TABLEGEN_EXE clang-tblgen) + find_program(CLANG_TABLEGEN_EXE "clang-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) gen_rst_file_from_td(FlangCommandLineReference.rst -gen-opt-docs FlangOptionsDocs.td docs-flang-html) endif() if (${SPHINX_OUTPUT_MAN}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2a72137 - [IR] Don't use blockaddresses as callbr arguments
Author: Nikita Popov Date: 2022-07-15T10:18:17+02:00 New Revision: 2a721374aef326d4668f750d341c86d1aa1a0309 URL: https://github.com/llvm/llvm-project/commit/2a721374aef326d4668f750d341c86d1aa1a0309 DIFF: https://github.com/llvm/llvm-project/commit/2a721374aef326d4668f750d341c86d1aa1a0309.diff LOG: [IR] Don't use blockaddresses as callbr arguments Following some recent discussions, this changes the representation of callbrs in IR. The current blockaddress arguments are replaced with `!` label constraints that refer directly to callbr indirect destinations: ; Before: %res = callbr i8* asm "", "=r,r,i"(i8* %x, i8* blockaddress(@test8, %foo)) to label %asm.fallthrough [label %foo] ; After: %res = callbr i8* asm "", "=r,r,!i"(i8* %x) to label %asm.fallthrough [label %foo] The benefit of this is that we can easily update the successors of a callbr, without having to worry about also updating blockaddress references. This should allow us to remove some limitations: * Allow unrolling/peeling/rotation of callbr, or any other clone-based optimizations (https://github.com/llvm/llvm-project/issues/41834) * Allow duplicate successors (https://github.com/llvm/llvm-project/issues/45248) This is just the IR representation change though, I will follow up with patches to remove limtations in various transformation passes that are no longer needed. Differential Revision: https://reviews.llvm.org/D129288 Added: Modified: clang/lib/CodeGen/CGStmt.cpp clang/test/CodeGen/asm-goto.c clang/test/CodeGen/asm.c clang/test/Modules/asm-goto.c llvm/docs/LangRef.rst llvm/docs/ReleaseNotes.rst llvm/include/llvm/IR/InlineAsm.h llvm/include/llvm/IR/Instructions.h llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/lib/IR/InlineAsm.cpp llvm/lib/IR/Instructions.cpp llvm/lib/IR/Verifier.cpp llvm/test/Analysis/BasicAA/pr52735.ll llvm/test/Assembler/call-arg-is-callee.ll llvm/test/Assembler/inline-asm-constraint-error.ll llvm/test/Bitcode/callbr.ll llvm/test/CodeGen/AArch64/callbr-asm-label.ll llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll llvm/test/CodeGen/ARM/speculation-hardening-sls.ll llvm/test/CodeGen/PowerPC/ppc64-inlineasm-clobber.ll llvm/test/CodeGen/SystemZ/asm-20.ll llvm/test/CodeGen/X86/callbr-asm-bb-exports.ll llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll llvm/test/CodeGen/X86/callbr-asm-branch-folding.ll llvm/test/CodeGen/X86/callbr-asm-destinations.ll llvm/test/CodeGen/X86/callbr-asm-instr-scheduling.ll llvm/test/CodeGen/X86/callbr-asm-kill.mir llvm/test/CodeGen/X86/callbr-asm-label-addr.ll llvm/test/CodeGen/X86/callbr-asm-obj-file.ll llvm/test/CodeGen/X86/callbr-asm-outputs-pred-succ.ll llvm/test/CodeGen/X86/callbr-asm-outputs.ll llvm/test/CodeGen/X86/callbr-asm-phi-placement.ll llvm/test/CodeGen/X86/callbr-asm-sink.ll llvm/test/CodeGen/X86/callbr-asm.ll llvm/test/CodeGen/X86/callbr-codegenprepare.ll llvm/test/CodeGen/X86/inline-asm-pic.ll llvm/test/CodeGen/X86/shrinkwrap-callbr.ll llvm/test/CodeGen/X86/speculation-hardening-sls.ll llvm/test/CodeGen/X86/tail-dup-asm-goto.ll llvm/test/Instrumentation/MemorySanitizer/msan_asm_conservative.ll llvm/test/Transforms/CallSiteSplitting/callsite-split-callbr.ll llvm/test/Transforms/CodeExtractor/PartialInlinePGOMultiRegion.ll llvm/test/Transforms/Coroutines/coro-debug.ll llvm/test/Transforms/GVN/callbr-loadpre-critedge.ll llvm/test/Transforms/GVN/callbr-scalarpre-critedge.ll llvm/test/Transforms/GVN/critical-edge-split-failure.ll llvm/test/Transforms/IROutliner/illegal-callbr.ll llvm/test/Transforms/Inline/blockaddress.ll llvm/test/Transforms/Inline/callbr.ll llvm/test/Transforms/JumpThreading/callbr-edge-split.ll llvm/test/Transforms/JumpThreading/pr46857-callbr.ll llvm/test/Transforms/LICM/callbr-crash.ll llvm/test/Transforms/LoopDeletion/two-predecessors.ll llvm/test/Transforms/LoopRotate/callbr.ll llvm/test/Transforms/LoopStrengthReduce/callbr-critical-edge-splitting.ll llvm/test/Transforms/LoopStrengthReduce/callbr-critical-edge-splitting2.ll llvm/test/Transforms/LoopStrengthReduce/remove_scev_indvars.ll llvm/test/Transforms/LoopUnroll/callbr.ll llvm/test/Transforms/PGOProfile/callbr.ll llvm/test/Transforms/SimpleLoopUnswitch/not-safe-to-clone.ll llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll llvm/test/Transforms/SimplifyCFG/jump-threading.ll llvm/test/Verifier/callbr.ll llvm/test/Verifier/dominates.ll llvm/test/tools/llvm-diff/callbr.ll llvm/test/tools/llvm-diff/phinode.ll
[clang] a4772cb - Revert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)"
Author: Nikita Popov Date: 2022-07-05T16:57:46+02:00 New Revision: a4772cbaf0dc717ab6b4639272ca2910897613f0 URL: https://github.com/llvm/llvm-project/commit/a4772cbaf0dc717ab6b4639272ca2910897613f0 DIFF: https://github.com/llvm/llvm-project/commit/a4772cbaf0dc717ab6b4639272ca2910897613f0.diff LOG: Revert "[SimplifyCFG] Thread branches on same condition in more cases (PR54980)" This reverts commit 4e545bdb355a470d601e9bb7f7b2693c99e61a3e. The newly added test is the third infinite combine loop caused by this change. In this case, it's a combination of the branch to common dest and jump threading folds that keeps peeling off loop iterations. The core problem here is that we ideally would not thread over loop backedges, both because it is potentially non-profitable (it may break canonical loop structure) and because it may result in these kinds of loops. Unfortunately, due to the lack of a dominator tree in SimplifyCFG, there is no good way to prevent this. While we have LoopHeaders, this is an optional structure and we don't do a good job of keeping it up to date. It would be fine for a profitability check, but is not suitable for a correctness check. So for now I'm just giving up here, as I don't see a good way to robustly prevent infinite combine loops. Fixes https://github.com/llvm/llvm-project/issues/56203. Added: Modified: clang/test/CodeGenObjC/exceptions.m clang/test/CodeGenObjCXX/exceptions-legacy.mm llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/test/CodeGen/AArch64/arm64-andCmpBrToTBZ.ll llvm/test/Transforms/GVNSink/sink-common-code.ll llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll llvm/test/Transforms/SimplifyCFG/jump-threading.ll llvm/test/Transforms/SimplifyCFG/pr55765.ll llvm/test/Transforms/SimplifyCFG/wc-widen-block.ll Removed: diff --git a/clang/test/CodeGenObjC/exceptions.m b/clang/test/CodeGenObjC/exceptions.m index 302e8af51ed8e..e01965edd73f2 100644 --- a/clang/test/CodeGenObjC/exceptions.m +++ b/clang/test/CodeGenObjC/exceptions.m @@ -25,12 +25,11 @@ void f1(void) { // CHECK-NEXT: icmp // CHECK-NEXT: br i1 @try { +// CHECK: call void asm sideeffect "", "=*m" // CHECK: call void asm sideeffect "", "*m" // CHECK-NEXT: call void @foo() foo(); // CHECK: call void @objc_exception_try_exit -// CHECK: try.handler: -// CHECK: call void asm sideeffect "", "=*m" } @finally { break; @@ -54,6 +53,12 @@ int f2(void) { // CHECK-NEXT: [[CAUGHT:%.*]] = icmp eq i32 [[SETJMP]], 0 // CHECK-NEXT: br i1 [[CAUGHT]] @try { +// Landing pad. Note that we elide the re-enter. +// CHECK: call void asm sideeffect "", "=*m,=*m"(i32* nonnull elementtype(i32) [[X]] +// CHECK-NEXT: call i8* @objc_exception_extract +// CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[X]] +// CHECK-NEXT: [[T2:%.*]] = add nsw i32 [[T1]], -1 + // CHECK: store i32 6, i32* [[X]] x++; // CHECK-NEXT: call void asm sideeffect "", "*m,*m"(i32* nonnull elementtype(i32) [[X]] @@ -62,12 +67,6 @@ int f2(void) { // CHECK-NEXT: [[T:%.*]] = load i32, i32* [[X]] foo(); } @catch (id) { -// Landing pad. Note that we elide the re-enter. -// CHECK: call void asm sideeffect "", "=*m,=*m"(i32* nonnull elementtype(i32) [[X]] -// CHECK-NEXT: call i8* @objc_exception_extract -// CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[X]] -// CHECK-NEXT: [[T2:%.*]] = add nsw i32 [[T1]], -1 - x--; } diff --git a/clang/test/CodeGenObjCXX/exceptions-legacy.mm b/clang/test/CodeGenObjCXX/exceptions-legacy.mm index 4166f635deecf..9d9e4e4b86df6 100644 --- a/clang/test/CodeGenObjCXX/exceptions-legacy.mm +++ b/clang/test/CodeGenObjCXX/exceptions-legacy.mm @@ -63,19 +63,20 @@ void test1(id obj, bool *failed) { // Body. // CHECK: invoke void @_Z3foov() +// Catch handler. Reload of 'failed' address is unnecessary. +// CHECK: [[T0:%.*]] = load i8*, i8** +// CHECK-NEXT: store i8 1, i8* [[T0]], +// CHECK-NEXT: br label + // Leave the @try. // CHECK: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: br label // CHECK: ret void + // Real EH cleanup. // CHECK: [[T0:%.*]] = landingpad // CHECK-NEXT:cleanup // CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: resume -// Catch handler. Reload of 'failed' address is unnecessary. -// CHECK: [[T0:%.*]] = load i8*, i8** -// CHECK-NEXT: store i8 1, i8* [[T0]], -// CHECK-NEXT: br label - diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index bbf596e1a1405..6b0f1e3760960 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2976,10 +2976,8 @@ static bool
[clang] 935570b - [ConstExpr] Don't create div/rem expressions
Author: Nikita Popov Date: 2022-07-05T15:54:53+02:00 New Revision: 935570b2ad808035a1fd9bf6fa894657babc8694 URL: https://github.com/llvm/llvm-project/commit/935570b2ad808035a1fd9bf6fa894657babc8694 DIFF: https://github.com/llvm/llvm-project/commit/935570b2ad808035a1fd9bf6fa894657babc8694.diff LOG: [ConstExpr] Don't create div/rem expressions This removes creation of udiv/sdiv/urem/srem constant expressions, in preparation for their removal. I've added a ConstantExpr::isDesirableBinOp() predicate to determine whether an expression should be created for a certain operator. With this patch, div/rem expressions can still be created through explicit IR/bitcode, forbidding them entirely will be the next step. Differential Revision: https://reviews.llvm.org/D128820 Added: Modified: clang/test/CodeGenCUDA/managed-var.cu clang/test/OpenMP/target_data_codegen.cpp clang/test/OpenMP/target_enter_data_codegen.cpp clang/test/OpenMP/target_enter_data_depend_codegen.cpp clang/test/OpenMP/target_exit_data_codegen.cpp clang/test/OpenMP/target_exit_data_depend_codegen.cpp clang/test/OpenMP/target_update_codegen.cpp clang/test/OpenMP/target_update_depend_codegen.cpp llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/IR/ConstantFolder.h llvm/include/llvm/IR/Constants.h llvm/lib/Analysis/ConstantFolding.cpp llvm/lib/Analysis/ScalarEvolution.cpp llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/Constants.cpp llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll llvm/test/Transforms/InstCombine/not-add.ll Removed: diff --git a/clang/test/CodeGenCUDA/managed-var.cu b/clang/test/CodeGenCUDA/managed-var.cu index 7b5f6bb4771a5..6915582e12127 100644 --- a/clang/test/CodeGenCUDA/managed-var.cu +++ b/clang/test/CodeGenCUDA/managed-var.cu @@ -144,9 +144,9 @@ float load3() { // HOST: %3 = getelementptr inbounds [100 x %struct.vec], [100 x %struct.vec]* %2, i64 0, i64 1, i32 1 // HOST: %4 = ptrtoint float* %3 to i64 // HOST: %5 = sub i64 %4, %1 -// HOST: %6 = sdiv exact i64 %5, 4 -// HOST: %7 = sitofp i64 %6 to float -// HOST: ret float %7 +// HOST: %sub.ptr.div = sdiv exact i64 %5, 4 +// HOST: %conv = sitofp i64 %sub.ptr.div to float +// HOST: ret float %conv float addr_taken2() { return (float)reinterpret_cast(&(v2[1].y)-&(v[1].x)); } diff --git a/clang/test/OpenMP/target_data_codegen.cpp b/clang/test/OpenMP/target_data_codegen.cpp index 2e9bd8d9cafbd..73a3bac1fc60e 100644 --- a/clang/test/OpenMP/target_data_codegen.cpp +++ b/clang/test/OpenMP/target_data_codegen.cpp @@ -152,7 +152,8 @@ void foo(int arg) { // CK1-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double*** // CK1-DAG: store [[ST]]* @gb, [[ST]]** [[CBP0]] // CK1-DAG: store double** getelementptr inbounds ([[ST]], [[ST]]* @gb, i32 0, i32 1), double*** [[CP0]] - // CK1-DAG: store i64 sdiv exact (i64 sub (i64 ptrtoint (double** getelementptr (double*, double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), i32 1) to i64), i64 ptrtoint (double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1) to i64)), i64 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)), i64* [[PS0]], + // CK1-DAG: [[DIV:%.+]] = sdiv exact i64 sub (i64 ptrtoint (double** getelementptr (double*, double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), i32 1) to i64), i64 ptrtoint (double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1) to i64)), ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) + // CK1-DAG: store i64 [[DIV]], i64* [[PS0]], // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 diff --git a/clang/test/OpenMP/target_enter_data_codegen.cpp b/clang/test/OpenMP/target_enter_data_codegen.cpp index 7e359cfab679d..81455cd02e588 100644 --- a/clang/test/OpenMP/target_enter_data_codegen.cpp +++ b/clang/test/OpenMP/target_enter_data_codegen.cpp @@ -158,7 +158,8 @@ void foo(int arg) { // CK1-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double*** // CK1-DAG: store [[ST]]* @gb, [[ST]]** [[CBP0]] // CK1-DAG: store double** getelementptr inbounds ([[ST]], [[ST]]* @gb, i32 0, i32 1), double*** [[CP0]] - // CK1-DAG: store i64 sdiv exact (i64 sub (i64 ptrtoint (double** getelementptr (double*, double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1), i32 1) to i64), i64 ptrtoint (double** getelementptr inbounds (%struct.ST, %struct.ST* @gb, i32 0, i32 1) to i64)), i64 ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)), i64* [[S0]], + // CK1-DAG: [[DIV:%.+]] = sdiv exact i64 sub (i64 ptrtoint (double** getelementptr (double*, double** getelementptr inbounds (%struct.ST,
[clang] 9ac3864 - [ConstExpr] Don't create insertvalue expressions
Author: Nikita Popov Date: 2022-07-01T09:23:28+02:00 New Revision: 9ac386495d3c9578e04c9aeb07a3d255b8cc8413 URL: https://github.com/llvm/llvm-project/commit/9ac386495d3c9578e04c9aeb07a3d255b8cc8413 DIFF: https://github.com/llvm/llvm-project/commit/9ac386495d3c9578e04c9aeb07a3d255b8cc8413.diff LOG: [ConstExpr] Don't create insertvalue expressions In preparation for the removal in D128719, this stops creating insertvalue constant expressions (well, unless they are directly used in LLVM IR). Differential Revision: https://reviews.llvm.org/D128792 Added: Modified: clang/lib/CodeGen/ItaniumCXXABI.cpp llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/IR/ConstantFolder.h llvm/lib/Analysis/ConstantFolding.cpp Removed: diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index c41b4192051a3..f0003c4aab78b 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -962,7 +962,9 @@ ItaniumCXXABI::EmitMemberPointerConversion(const CastExpr *E, else dstAdj = llvm::ConstantExpr::getNSWAdd(srcAdj, adj); - return llvm::ConstantExpr::getInsertValue(src, dstAdj, 1); + llvm::Constant *res = ConstantFoldInsertValueInstruction(src, dstAdj, 1); + assert(res != nullptr && "Folding must succeed"); + return res; } llvm::Constant * diff --git a/llvm/include/llvm/Analysis/TargetFolder.h b/llvm/include/llvm/Analysis/TargetFolder.h index a360be5313aec..93ac33ce5effe 100644 --- a/llvm/include/llvm/Analysis/TargetFolder.h +++ b/llvm/include/llvm/Analysis/TargetFolder.h @@ -133,7 +133,7 @@ class TargetFolder final : public IRBuilderFolder { auto *CAgg = dyn_cast(Agg); auto *CVal = dyn_cast(Val); if (CAgg && CVal) - return Fold(ConstantExpr::getInsertValue(CAgg, CVal, IdxList)); + return ConstantFoldInsertValueInstruction(CAgg, CVal, IdxList); return nullptr; } diff --git a/llvm/include/llvm/IR/ConstantFolder.h b/llvm/include/llvm/IR/ConstantFolder.h index 9cf68dc39a652..1243043a64d64 100644 --- a/llvm/include/llvm/IR/ConstantFolder.h +++ b/llvm/include/llvm/IR/ConstantFolder.h @@ -123,7 +123,7 @@ class ConstantFolder final : public IRBuilderFolder { auto *CAgg = dyn_cast(Agg); auto *CVal = dyn_cast(Val); if (CAgg && CVal) - return ConstantExpr::getInsertValue(CAgg, CVal, IdxList); + return ConstantFoldInsertValueInstruction(CAgg, CVal, IdxList); return nullptr; } diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 01092b4892f6b..b2b071cc662e0 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -1093,7 +1093,7 @@ Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, case Instruction::InsertElement: return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]); case Instruction::InsertValue: -return ConstantExpr::getInsertValue( +return ConstantFoldInsertValueInstruction( Ops[0], Ops[1], cast(InstOrCE)->getIndices()); case Instruction::ShuffleVector: return ConstantExpr::getShuffleVector( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5548e80 - [IR] Remove support for extractvalue constant expression
Author: Nikita Popov Date: 2022-06-28T10:40:17+02:00 New Revision: 5548e807b5777fdda167b6795e0e05432a6163f1 URL: https://github.com/llvm/llvm-project/commit/5548e807b5777fdda167b6795e0e05432a6163f1 DIFF: https://github.com/llvm/llvm-project/commit/5548e807b5777fdda167b6795e0e05432a6163f1.diff LOG: [IR] Remove support for extractvalue constant expression This removes the extractvalue constant expression, as part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179. extractvalue is already not supported in bitcode, so we do not need to worry about bitcode auto-upgrade. Uses of ConstantExpr::getExtractValue() should be replaced with IRBuilder::CreateExtractValue() (if the fact that the result is constant is not important) or ConstantFoldExtractValueInstruction() (if it is). Though for this particular case, it is also possible and usually preferable to use getAggregateElement() instead. The C API function LLVMConstExtractValue() is removed, as the underlying constant expression no longer exists. Instead, LLVMBuildExtractValue() should be used (which will constant fold or create an instruction). Depending on the use-case, LLVMGetAggregateElement() may also be used instead. Differential Revision: https://reviews.llvm.org/D125795 Added: llvm/test/Assembler/unsupported-constexprs.ll Modified: clang/lib/CodeGen/ItaniumCXXABI.cpp llvm/bindings/go/llvm/ir.go llvm/bindings/ocaml/llvm/llvm.ml llvm/bindings/ocaml/llvm/llvm.mli llvm/bindings/ocaml/llvm/llvm_ocaml.c llvm/docs/ReleaseNotes.rst llvm/include/llvm-c/Core.h llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/IR/ConstantFolder.h llvm/include/llvm/IR/Constants.h llvm/lib/Analysis/ConstantFolding.cpp llvm/lib/Analysis/InlineCost.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/IR/Constants.cpp llvm/lib/IR/ConstantsContext.h llvm/lib/IR/Core.cpp llvm/lib/Transforms/Coroutines/CoroElide.cpp llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/lib/Transforms/Utils/Evaluator.cpp llvm/test/Assembler/insertextractvalue.ll llvm/test/CodeGen/Generic/pr33094.ll llvm/test/Transforms/InstCombine/cast.ll llvm/test/Transforms/InstCombine/pr28725.ll llvm/test/Transforms/InstSimplify/pr28725.ll Removed: llvm/test/CodeGen/X86/nonconst-static-ev.ll diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index f51e9b303236b..c41b4192051a3 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -955,7 +955,7 @@ ItaniumCXXABI::EmitMemberPointerConversion(const CastExpr *E, adj = llvm::ConstantInt::get(adj->getType(), offset); } - llvm::Constant *srcAdj = llvm::ConstantExpr::getExtractValue(src, 1); + llvm::Constant *srcAdj = src->getAggregateElement(1); llvm::Constant *dstAdj; if (isDerivedToBase) dstAdj = llvm::ConstantExpr::getNSWSub(srcAdj, adj); diff --git a/llvm/bindings/go/llvm/ir.go b/llvm/bindings/go/llvm/ir.go index 7bf92e60a2753..14cad0cb7ed30 100644 --- a/llvm/bindings/go/llvm/ir.go +++ b/llvm/bindings/go/llvm/ir.go @@ -993,20 +993,6 @@ func ConstShuffleVector(veca, vecb, mask Value) (rv Value) { return } -//TODO -//LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, -// unsigned NumIdx); - -func ConstExtractValue(agg Value, indices []uint32) (rv Value) { - n := len(indices) - if n == 0 { - panic("one or more indices are required") - } - ptr := (*C.unsigned)([0]) - rv.C = C.LLVMConstExtractValue(agg.C, ptr, C.unsigned(n)) - return -} - func ConstInsertValue(agg, val Value, indices []uint32) (rv Value) { n := len(indices) if n == 0 { diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml index b20c113ef32e4..bf8b96959f819 100644 --- a/llvm/bindings/ocaml/llvm/llvm.ml +++ b/llvm/bindings/ocaml/llvm/llvm.ml @@ -704,8 +704,6 @@ external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue = "LLVMConstInsertElement" external const_shufflevector : llvalue -> llvalue -> llvalue -> llvalue = "LLVMConstShuffleVector" -external const_extractvalue : llvalue -> int array -> llvalue -= "llvm_const_extractvalue" external const_insertvalue : llvalue -> llvalue -> int array -> llvalue = "llvm_const_insertvalue" external const_inline_asm : lltype -> string -> string -> bool -> bool -> diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli index af303774e0b96..385c3cc272d15 100644 --- a/llvm/bindings/ocaml/llvm/llvm.mli +++ b/llvm/bindings/ocaml/llvm/llvm.mli @@ -1347,11 +1347,6 @@ val const_insertelement : llvalue -> llvalue -> llvalue
[clang] 6f258c0 - [Clang] Don't test register allocation
Author: Nikita Popov Date: 2022-06-23T12:46:00+02:00 New Revision: 6f258c0fd34cf4001ffa08c61f6e4e0f1254c50f URL: https://github.com/llvm/llvm-project/commit/6f258c0fd34cf4001ffa08c61f6e4e0f1254c50f DIFF: https://github.com/llvm/llvm-project/commit/6f258c0fd34cf4001ffa08c61f6e4e0f1254c50f.diff LOG: [Clang] Don't test register allocation This test was broken by 719658d078c4093d1ee716fb65ae94673df7b22b. How did an assembly test get into clang/test? Added: Modified: clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu Removed: diff --git a/clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu b/clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu index 96892286fd75e..946927d88a1ee 100644 --- a/clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu +++ b/clang/test/CodeGenCUDA/atomics-remarks-gfx90a.cu @@ -9,7 +9,7 @@ // GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at system memory scope // GFX90A-CAS-LABEL: _Z14atomic_add_casPf -// GFX90A-CAS: flat_atomic_cmpswap v0, v[2:3], v[4:5] glc +// GFX90A-CAS: flat_atomic_cmpswap // GFX90A-CAS: s_cbranch_execnz __device__ float atomic_add_cas(float *p) { return __atomic_fetch_add(p, 1.0f, memory_order_relaxed); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 30ad481 - Revert "cmake: use llvm dir variables for clang/utils/hmaptool"
Author: Nikita Popov Date: 2022-06-02T14:55:58+02:00 New Revision: 30ad481e87ca7cd2250bd5771ab66ddfe623eb10 URL: https://github.com/llvm/llvm-project/commit/30ad481e87ca7cd2250bd5771ab66ddfe623eb10 DIFF: https://github.com/llvm/llvm-project/commit/30ad481e87ca7cd2250bd5771ab66ddfe623eb10.diff LOG: Revert "cmake: use llvm dir variables for clang/utils/hmaptool" As discussed on the review, this change breaks the standalone clang build. When building against an installed LLVM, the LLVM_TOOLS_BINARY_DIR cmake variable points to the location of the installed LLVM tools, not to the cmake build directory. This means that we would end up trying to move hmaptool into something like /usr/bin as part of the normal build, while this should only be happening when running an install target. This reverts commit bf1ab1f0eb9578914343f48096229ecccd0ecf52. Added: Modified: clang/utils/hmaptool/CMakeLists.txt Removed: diff --git a/clang/utils/hmaptool/CMakeLists.txt b/clang/utils/hmaptool/CMakeLists.txt index 01b6a920fb94..f0d9866782b8 100644 --- a/clang/utils/hmaptool/CMakeLists.txt +++ b/clang/utils/hmaptool/CMakeLists.txt @@ -1,9 +1,19 @@ -add_custom_command(OUTPUT "${LLVM_TOOLS_BINARY_DIR}/hmaptool" - COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool" "${LLVM_TOOLS_BINARY_DIR}" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool") +set(CLANG_HMAPTOOL hmaptool) -install(PROGRAMS hmaptool DESTINATION "${LLVM_TOOLS_INSTALL_DIR}" COMPONENT hmaptool) -add_custom_target(hmaptool ALL DEPENDS "${LLVM_TOOLS_BINARY_DIR}/hmaptool") +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL} + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/ + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL}) + +list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}) +install(PROGRAMS ${CLANG_HMAPTOOL} +DESTINATION "${CMAKE_INSTALL_BINDIR}" +COMPONENT hmaptool) + +add_custom_target(hmaptool ALL DEPENDS ${Depends}) set_target_properties(hmaptool PROPERTIES FOLDER "Utils") if(NOT LLVM_ENABLE_IDE) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 858e627 - [Clang] Always set opaque pointers mode
Author: Nikita Popov Date: 2022-05-31T15:43:05+02:00 New Revision: 858e6273d938cc4d08ee053ddff3fe7b19eb302a URL: https://github.com/llvm/llvm-project/commit/858e6273d938cc4d08ee053ddff3fe7b19eb302a DIFF: https://github.com/llvm/llvm-project/commit/858e6273d938cc4d08ee053ddff3fe7b19eb302a.diff LOG: [Clang] Always set opaque pointers mode Always set the opaque pointers mode, to make sure that -no-opaque-pointers continues working when the default on the LLVM side is flipped. Added: Modified: clang/lib/CodeGen/CodeGenAction.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index af7a60c179a67..4ffbecdf27411 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -1017,8 +1017,7 @@ CodeGenAction::CreateASTConsumer(CompilerInstance , StringRef InFile) { if (BA != Backend_EmitNothing && !OS) return nullptr; - if (CI.getCodeGenOpts().OpaquePointers) -VMContext->setOpaquePointers(true); + VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); // Load bitcode modules to link with, if we need to. if (LinkModules.empty()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 4e545bd - [SimplifyCFG] Thread branches on same condition in more cases (PR54980)
Author: Nikita Popov Date: 2022-04-29T09:44:05+02:00 New Revision: 4e545bdb355a470d601e9bb7f7b2693c99e61a3e URL: https://github.com/llvm/llvm-project/commit/4e545bdb355a470d601e9bb7f7b2693c99e61a3e DIFF: https://github.com/llvm/llvm-project/commit/4e545bdb355a470d601e9bb7f7b2693c99e61a3e.diff LOG: [SimplifyCFG] Thread branches on same condition in more cases (PR54980) SimplifyCFG implements basic jump threading, if a branch is performed on a phi node with constant operands. However, InstCombine canonicalizes such phis to the condition value of a previous branch, if possible. SimplifyCFG does support this as well, but only in the very limited case where the same condition is used in a direct predecessor -- notably, this does not include the common diamond pattern (i.e. two consecutive if/elses on the same condition). This patch extends the code to look back a limited number of blocks to find a branch on the same value, rather than only looking at the direct predecessor. Fixes https://github.com/llvm/llvm-project/issues/54980. Differential Revision: https://reviews.llvm.org/D124159 Added: Modified: clang/test/CodeGenObjC/exceptions.m clang/test/CodeGenObjCXX/exceptions-legacy.mm llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/test/CodeGen/AArch64/arm64-andCmpBrToTBZ.ll llvm/test/Transforms/GVNSink/sink-common-code.ll llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll llvm/test/Transforms/SimplifyCFG/jump-threading.ll llvm/test/Transforms/SimplifyCFG/wc-widen-block.ll Removed: diff --git a/clang/test/CodeGenObjC/exceptions.m b/clang/test/CodeGenObjC/exceptions.m index e01965edd73f2..302e8af51ed8e 100644 --- a/clang/test/CodeGenObjC/exceptions.m +++ b/clang/test/CodeGenObjC/exceptions.m @@ -25,11 +25,12 @@ void f1(void) { // CHECK-NEXT: icmp // CHECK-NEXT: br i1 @try { -// CHECK: call void asm sideeffect "", "=*m" // CHECK: call void asm sideeffect "", "*m" // CHECK-NEXT: call void @foo() foo(); // CHECK: call void @objc_exception_try_exit +// CHECK: try.handler: +// CHECK: call void asm sideeffect "", "=*m" } @finally { break; @@ -53,12 +54,6 @@ int f2(void) { // CHECK-NEXT: [[CAUGHT:%.*]] = icmp eq i32 [[SETJMP]], 0 // CHECK-NEXT: br i1 [[CAUGHT]] @try { -// Landing pad. Note that we elide the re-enter. -// CHECK: call void asm sideeffect "", "=*m,=*m"(i32* nonnull elementtype(i32) [[X]] -// CHECK-NEXT: call i8* @objc_exception_extract -// CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[X]] -// CHECK-NEXT: [[T2:%.*]] = add nsw i32 [[T1]], -1 - // CHECK: store i32 6, i32* [[X]] x++; // CHECK-NEXT: call void asm sideeffect "", "*m,*m"(i32* nonnull elementtype(i32) [[X]] @@ -67,6 +62,12 @@ int f2(void) { // CHECK-NEXT: [[T:%.*]] = load i32, i32* [[X]] foo(); } @catch (id) { +// Landing pad. Note that we elide the re-enter. +// CHECK: call void asm sideeffect "", "=*m,=*m"(i32* nonnull elementtype(i32) [[X]] +// CHECK-NEXT: call i8* @objc_exception_extract +// CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[X]] +// CHECK-NEXT: [[T2:%.*]] = add nsw i32 [[T1]], -1 + x--; } diff --git a/clang/test/CodeGenObjCXX/exceptions-legacy.mm b/clang/test/CodeGenObjCXX/exceptions-legacy.mm index 9d9e4e4b86df6..4166f635deecf 100644 --- a/clang/test/CodeGenObjCXX/exceptions-legacy.mm +++ b/clang/test/CodeGenObjCXX/exceptions-legacy.mm @@ -63,20 +63,19 @@ void test1(id obj, bool *failed) { // Body. // CHECK: invoke void @_Z3foov() -// Catch handler. Reload of 'failed' address is unnecessary. -// CHECK: [[T0:%.*]] = load i8*, i8** -// CHECK-NEXT: store i8 1, i8* [[T0]], -// CHECK-NEXT: br label - // Leave the @try. // CHECK: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: br label // CHECK: ret void - // Real EH cleanup. // CHECK: [[T0:%.*]] = landingpad // CHECK-NEXT:cleanup // CHECK-NEXT: call void @objc_exception_try_exit([[BUF_T]]* nonnull [[BUF]]) // CHECK-NEXT: resume +// Catch handler. Reload of 'failed' address is unnecessary. +// CHECK: [[T0:%.*]] = load i8*, i8** +// CHECK-NEXT: store i8 1, i8* [[T0]], +// CHECK-NEXT: br label + diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index d2b7b71e611d5..cd47a1e7e456a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2975,8 +2975,10 @@ static bool BlockIsSimpleEnoughToThreadThrough(BasicBlock *BB) { return true; } -static ConstantInt *getKnownValueOnEdge(Value *V, BasicBlock *From, -BasicBlock *To) { +static ConstantInt * +getKnownValueOnEdge(Value *V, BasicBlock *From, BasicBlock *To, +
[clang] 2978d02 - [Clang] Remove support for legacy pass manager
Author: Nikita Popov Date: 2022-04-13T10:21:42+02:00 New Revision: 2978d026819b82f77eef42d92b3b53919f375bd8 URL: https://github.com/llvm/llvm-project/commit/2978d026819b82f77eef42d92b3b53919f375bd8 DIFF: https://github.com/llvm/llvm-project/commit/2978d026819b82f77eef42d92b3b53919f375bd8.diff LOG: [Clang] Remove support for legacy pass manager This removes the -flegacy-pass-manager and -fno-experimental-new-pass-manager options, and the corresponding support code in BackendUtil. The -fno-legacy-pass-manager and -fexperimental-new-pass-manager options are retained as no-ops. Differential Revision: https://reviews.llvm.org/D123609 Added: Modified: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td clang/lib/CodeGen/BackendUtil.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/Driver/flegacy-pass-manager.c Removed: diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 720a59ff1bdce..3aef6f75302b5 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -65,7 +65,6 @@ CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with optno CODEGENOPT(ExperimentalStrictFloatingPoint, 1, 0) ///< Enables the new, experimental ///< strict floating point. CODEGENOPT(EnableNoundefAttrs, 1, 0) ///< Enable emitting `noundef` attributes on IR call arguments and return values -CODEGENOPT(LegacyPassManager, 1, 0) ///< Use the legacy pass manager. CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new ///< pass manager. CODEGENOPT(DisableRedZone, 1, 0) ///< Set when -mno-red-zone is enabled. diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 322cc800f7525..9ffc79a52b0ed 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1935,15 +1935,10 @@ def fglobal_isel : Flag<["-"], "fglobal-isel">, Group, HelpText<"Enables the global instruction selector">; def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, Alias; -defm legacy_pass_manager : BoolOption<"f", "legacy-pass-manager", - CodeGenOpts<"LegacyPassManager">, DefaultFalse, - PosFlag, - NegFlag, - BothFlags<[CC1Option]>>, Group; +def fno_legacy_pass_manager : Flag<["-"], "fno-legacy-pass-manager">, + Group, Flags<[CC1Option, NoArgumentUnused]>; def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, Group, Flags<[CC1Option]>, Alias; -def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, - Group, Flags<[CC1Option,NoDriverOption]>, Alias; def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">, Group, Flags<[CC1Option]>, HelpText<"Enables experimental strict floating point in LLVM.">, diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index c09afefb3cc9a..c78ea45384d72 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -60,7 +60,6 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/LowerTypeTests.h" -#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h" #include "llvm/Transforms/InstCombine/InstCombine.h" #include "llvm/Transforms/Instrumentation.h" @@ -127,8 +126,6 @@ class EmitAssemblyHelper { return TargetIRAnalysis(); } - void CreatePasses(legacy::PassManager , legacy::FunctionPassManager ); - /// Generates the TargetMachine. /// Leaves TM unchanged if it is unable to create the target machine. /// Some of our clang tests specify triples which are not built @@ -192,60 +189,10 @@ class EmitAssemblyHelper { std::unique_ptr TM; - // Emit output using the legacy pass manager for the optimization pipeline. - // This will be removed soon when using the legacy pass manager for the - // optimization pipeline is no longer supported. - void EmitAssemblyWithLegacyPassManager(BackendAction Action, - std::unique_ptr OS); - - // Emit output using the new pass manager for the optimization pipeline. This - // is the default. + // Emit output using the new pass manager for the optimization pipeline. void EmitAssembly(BackendAction Action, std::unique_ptr OS); }; - -// We need this wrapper to access LangOpts and CGOpts from extension functions -// that we add to the PassManagerBuilder. -class PassManagerBuilderWrapper : public PassManagerBuilder { -public: -
[clang] 918c5a9 - [Clang] Avoid legacy PM in some tests (NFC)
Author: Nikita Popov Date: 2022-04-11T16:15:57+02:00 New Revision: 918c5a926090214bc6843854afb4750673b4c3ae URL: https://github.com/llvm/llvm-project/commit/918c5a926090214bc6843854afb4750673b4c3ae DIFF: https://github.com/llvm/llvm-project/commit/918c5a926090214bc6843854afb4750673b4c3ae.diff LOG: [Clang] Avoid legacy PM in some tests (NFC) Either remove legacy PM run lines or change them to use new PM. Added: Modified: clang/test/CodeGen/asan-destructor-kind.cpp clang/test/CodeGen/cfi-icall-cross-dso.c clang/test/CodeGen/cspgo-instrumentation_thinlto.c clang/test/CodeGen/dllimport.c clang/test/CodeGen/enable-split-lto-unit.ll clang/test/CodeGen/hwasan-stack-safety-analysis.c clang/test/CodeGen/inline2.c clang/test/CodeGen/tbaa-for-vptr.cpp Removed: diff --git a/clang/test/CodeGen/asan-destructor-kind.cpp b/clang/test/CodeGen/asan-destructor-kind.cpp index 8d70b663f67a2..50188067c68b3 100644 --- a/clang/test/CodeGen/asan-destructor-kind.cpp +++ b/clang/test/CodeGen/asan-destructor-kind.cpp @@ -6,23 +6,13 @@ // CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg' // Default is global dtor -// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 \ -// RUN: -fno-legacy-pass-manager %s \ -// RUN: | FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR -// -// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 \ -// RUN: -flegacy-pass-manager %s \ +// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 %s \ // RUN: | FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR // Explictly ask for global dtor // RUN: %clang_cc1 -fsanitize=address \ // RUN: -fsanitize-address-destructor=global -emit-llvm -o - \ -// RUN: -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \ -// RUN: FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR -// -// RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor=global -emit-llvm -o - \ -// RUN: -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \ +// RUN: -triple x86_64-apple-macosx10.15 %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR // CHECK-GLOBAL-DTOR: llvm.global_dtor{{.+}}asan.module_dtor @@ -31,12 +21,7 @@ // Explictly ask for no dtors // RUN: %clang_cc1 -fsanitize=address \ // RUN: -fsanitize-address-destructor=none -emit-llvm -o - \ -// RUN: -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \ -// RUN: FileCheck %s --check-prefixes=CHECK-NONE-DTOR -// -// RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor=none -emit-llvm -o - \ -// RUN: -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \ +// RUN: -triple x86_64-apple-macosx10.15 %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-NONE-DTOR int global; diff --git a/clang/test/CodeGen/cfi-icall-cross-dso.c b/clang/test/CodeGen/cfi-icall-cross-dso.c index 02399e7b30dc1..deaf12d83fe28 100644 --- a/clang/test/CodeGen/cfi-icall-cross-dso.c +++ b/clang/test/CodeGen/cfi-icall-cross-dso.c @@ -1,25 +1,25 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux -O1 -fno-experimental-new-pass-manager \ +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux -O1 -fno-inline \ // RUN: -fsanitize=cfi-icall -fsanitize-cfi-cross-dso \ // RUN: -fsanitize-cfi-canonical-jump-tables -emit-llvm -o - %s | FileCheck \ // RUN: --check-prefix=CHECK --check-prefix=CHECK-DIAG \ // RUN: --check-prefix=ITANIUM --check-prefix=ITANIUM-DIAG \ // RUN: %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux -O1 -fno-experimental-new-pass-manager \ +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux -O1 -fno-inline \ // RUN: -fsanitize=cfi-icall -fsanitize-cfi-cross-dso -fsanitize-trap=cfi-icall \ // RUN: -fsanitize-cfi-canonical-jump-tables -emit-llvm -o - %s | FileCheck \ // RUN: --check-prefix=CHECK \ // RUN: --check-prefix=ITANIUM --check-prefix=ITANIUM-TRAP \ // RUN: %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-pc-windows-msvc -O1 -fno-experimental-new-pass-manager \ +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-pc-windows-msvc -O1 -fno-inline \ // RUN: -fsanitize=cfi-icall -fsanitize-cfi-cross-dso \ // RUN: -fsanitize-cfi-canonical-jump-tables -emit-llvm -o - %s | FileCheck \ // RUN: --check-prefix=CHECK --check-prefix=CHECK-DIAG \ // RUN: --check-prefix=MS --check-prefix=MS-DIAG \ // RUN: %s -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-pc-windows-msvc -O1 -fno-experimental-new-pass-manager \ +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-pc-windows-msvc -O1 -fno-inline \ // RUN: -fsanitize=cfi-icall -fsanitize-cfi-cross-dso -fsanitize-trap=cfi-icall \
[clang] b00d0fa - [Clang] Add -no-opaque-pointers to native powerpc test (NFC)
Author: Nikita Popov Date: 2022-04-11T13:15:46+02:00 New Revision: b00d0fa2c7f0a187867c535b3f7006376420d58f URL: https://github.com/llvm/llvm-project/commit/b00d0fa2c7f0a187867c535b3f7006376420d58f DIFF: https://github.com/llvm/llvm-project/commit/b00d0fa2c7f0a187867c535b3f7006376420d58f.diff LOG: [Clang] Add -no-opaque-pointers to native powerpc test (NFC) Does not run on x86, so I missed this before. The test currently has typed pointer check lines. Added: Modified: clang/test/CodeGen/PowerPC/ppc-mm-malloc.c Removed: diff --git a/clang/test/CodeGen/PowerPC/ppc-mm-malloc.c b/clang/test/CodeGen/PowerPC/ppc-mm-malloc.c index 25711e80fffd2..e5920b76d0e3c 100644 --- a/clang/test/CodeGen/PowerPC/ppc-mm-malloc.c +++ b/clang/test/CodeGen/PowerPC/ppc-mm-malloc.c @@ -6,7 +6,7 @@ // require installing target headers in build env, otherwise expecting // failures. So this test will focus on native build only. -// RUN: %clang -target powerpc64-unknown-linux-gnu -S -emit-llvm %s -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s +// RUN: %clang -Xclang -no-opaque-pointers -target powerpc64-unknown-linux-gnu -S -emit-llvm %s -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b72fd1a - [CGCall] Check store type in findDominatingStoreToReturnValue()
Author: Nikita Popov Date: 2022-04-11T12:08:29+02:00 New Revision: b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4 URL: https://github.com/llvm/llvm-project/commit/b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4 DIFF: https://github.com/llvm/llvm-project/commit/b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4.diff LOG: [CGCall] Check store type in findDominatingStoreToReturnValue() We need to make sure that the stored type matches the return type. Added: Modified: clang/lib/CodeGen/CGCall.cpp clang/test/CodeGenObjC/section-name.m Removed: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index c4d342e3d2aaa..e6a5fd1f4f985 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3228,7 +3228,8 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction ) { // ReturnValue to some other location. auto GetStoreIfValid = [](llvm::User *U) -> llvm::StoreInst * { auto *SI = dyn_cast(U); -if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer()) +if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer() || +SI->getValueOperand()->getType() != CGF.ReturnValue.getElementType()) return nullptr; // These aren't actually possible for non-coerced returns, and we // only care about non-coerced returns on this code path. diff --git a/clang/test/CodeGenObjC/section-name.m b/clang/test/CodeGenObjC/section-name.m index b6b9fa4a59f19..63fad82af4e6e 100644 --- a/clang/test/CodeGenObjC/section-name.m +++ b/clang/test/CodeGenObjC/section-name.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple thumbv7--windows-itanium -fdeclspec -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s +// RUN: %clang_cc1 -triple thumbv7--windows-itanium -fdeclspec -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s @protocol Protocol - (void) protocol_method; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 702d5de - [Clang] Enable opaque pointers by default
Author: Nikita Popov Date: 2022-04-11T11:13:45+02:00 New Revision: 702d5de4380b1e1554e5b90863093c3a57f76f70 URL: https://github.com/llvm/llvm-project/commit/702d5de4380b1e1554e5b90863093c3a57f76f70 DIFF: https://github.com/llvm/llvm-project/commit/702d5de4380b1e1554e5b90863093c3a57f76f70.diff LOG: [Clang] Enable opaque pointers by default Enable opaque pointers by default in clang, which can be disabled either via cc1 option -no-opaque-pointers or cmake flag -DCLANG_ENABLE_OPAQUE_POINTERS=OFF. See https://llvm.org/docs/OpaquePointers.html for context. Differential Revision: https://reviews.llvm.org/D123300 Added: Modified: clang/CMakeLists.txt llvm/docs/OpaquePointers.rst Removed: diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 3a77e7b0c8d60..594e6d0887429 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -251,7 +251,7 @@ option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON) set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING "Enable opaque pointers by default") if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT") - set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF) + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) elseif(CLANG_ENABLE_OPAQUE_POINTERS) set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) else() diff --git a/llvm/docs/OpaquePointers.rst b/llvm/docs/OpaquePointers.rst index 6e684369b6b35..12689d8cd6ccc 100644 --- a/llvm/docs/OpaquePointers.rst +++ b/llvm/docs/OpaquePointers.rst @@ -195,8 +195,10 @@ Transition State As of April 2022 both LLVM and Clang have complete support for opaque pointers, -but typed pointers are still the default. Opaque pointers will be enabled by -default in Clang soon. +and opaque pointers are enabled by default in Clang. It is possible to +temporarily restore the old default using the +``-DCLANG_ENABLE_OPAQUE_POINTERS=OFF`` cmake option. Opaque pointers can be +disabled for a single Clang invocation using ``-Xclang -no-opaque-pointers``. The MLIR and Polly monorepo projects are not fully compatible with opaque pointers yet. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 69f7f15 - [Clang] Add -no-opaque-pointers to recently added test (NFC)
Author: Nikita Popov Date: 2022-04-11T11:13:38+02:00 New Revision: 69f7f15683c451378dbe9029a0bd2dbd029bcf3a URL: https://github.com/llvm/llvm-project/commit/69f7f15683c451378dbe9029a0bd2dbd029bcf3a DIFF: https://github.com/llvm/llvm-project/commit/69f7f15683c451378dbe9029a0bd2dbd029bcf3a.diff LOG: [Clang] Add -no-opaque-pointers to recently added test (NFC) Added: Modified: clang/test/CodeGen/PowerPC/quadword-atomics.c Removed: diff --git a/clang/test/CodeGen/PowerPC/quadword-atomics.c b/clang/test/CodeGen/PowerPC/quadword-atomics.c index b1da89c2785b7..e8ea687ba5347 100644 --- a/clang/test/CodeGen/PowerPC/quadword-atomics.c +++ b/clang/test/CodeGen/PowerPC/quadword-atomics.c @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -Werror -Wno-atomic-alignment -triple powerpc64le-linux-gnu \ +// RUN: %clang_cc1 -no-opaque-pointers -Werror -Wno-atomic-alignment -triple powerpc64le-linux-gnu \ // RUN: -target-cpu pwr8 -emit-llvm -o - %s | FileCheck %s --check-prefix=PPC64-PWR8 -// RUN: %clang_cc1 -Werror -Wno-atomic-alignment -triple powerpc64le-linux-gnu \ +// RUN: %clang_cc1 -no-opaque-pointers -Werror -Wno-atomic-alignment -triple powerpc64le-linux-gnu \ // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=PPC64 -// RUN: %clang_cc1 -Werror -Wno-atomic-alignment -triple powerpc64-unknown-aix \ +// RUN: %clang_cc1 -no-opaque-pointers -Werror -Wno-atomic-alignment -triple powerpc64-unknown-aix \ // RUN: -target-cpu pwr7 -emit-llvm -o - %s | FileCheck %s --check-prefix=PPC64 typedef struct { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2121dc5 - [llvm-lto] Remove support for legacy pass manager
Author: Nikita Popov Date: 2022-04-11T09:40:17+02:00 New Revision: 2121dc5b158b0d11667a5d8c39f0121b869ca1c5 URL: https://github.com/llvm/llvm-project/commit/2121dc5b158b0d11667a5d8c39f0121b869ca1c5 DIFF: https://github.com/llvm/llvm-project/commit/2121dc5b158b0d11667a5d8c39f0121b869ca1c5.diff LOG: [llvm-lto] Remove support for legacy pass manager This removes support for the legacy pass manager in llvm-lto and llvm-lto2. In this case I've dropped the use-new-pm option entirely, as I don't think this is considered part of the public interface. This also makes -debug-pass-manager work with llvm-lto, because that was needed to migrate some tests to NewPM. Differential Revision: https://reviews.llvm.org/D123376 Added: Modified: clang/test/Driver/memtag_lto.c llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h llvm/test/Analysis/StackSafetyAnalysis/ipa-alias.ll llvm/test/Analysis/StackSafetyAnalysis/ipa.ll llvm/test/Feature/load_extension.ll llvm/test/LTO/Resolution/X86/load-sample-prof-icp.ll llvm/test/LTO/Resolution/X86/load-sample-prof-lto.ll llvm/test/LTO/X86/diagnostic-handler-remarks.ll llvm/test/LTO/X86/disable-verify.ll llvm/test/LTO/X86/tailcallelim.ll llvm/test/LTO/X86/tli-nobuiltin.ll llvm/test/Other/X86/lto-hot-cold-split.ll llvm/test/ThinLTO/X86/cfi-devirt.ll llvm/test/ThinLTO/X86/cfi-unsat.ll llvm/test/ThinLTO/X86/cfi.ll llvm/test/ThinLTO/X86/devirt-after-icp.ll llvm/test/ThinLTO/X86/devirt.ll llvm/test/ThinLTO/X86/devirt2.ll llvm/test/ThinLTO/X86/devirt_check.ll llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll llvm/test/ThinLTO/X86/devirt_local_same_guid.ll llvm/test/ThinLTO/X86/devirt_promote.ll llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll llvm/test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll llvm/test/ThinLTO/X86/newpm-basic.ll llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll llvm/test/ThinLTO/X86/printer.ll llvm/test/tools/llvm-lto2/X86/pipeline.ll llvm/test/tools/llvm-lto2/X86/slp-vectorize-pm.ll llvm/tools/llvm-lto/llvm-lto.cpp llvm/tools/llvm-lto2/llvm-lto2.cpp Removed: diff --git a/clang/test/Driver/memtag_lto.c b/clang/test/Driver/memtag_lto.c index 2d3445c359fa5..d73670f99cb60 100644 --- a/clang/test/Driver/memtag_lto.c +++ b/clang/test/Driver/memtag_lto.c @@ -10,7 +10,7 @@ // Full LTO // RUN: %clang -O1 -target aarch64-unknown-linux -c %s -flto=full -o %t.ltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -use-new-pm -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.ltonewpm1.bc,fn,plx \ // RUN: -r %t.ltonewpm1.bc,use,lx \ // RUN: -r %t.ltonewpm1.bc,use_local,plx \ @@ -21,7 +21,7 @@ // Thin LTO, new PM // RUN: %clang -O1 -target aarch64-unknown-linux -c %s -flto=thin -o %t.thinltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc -// RUN: llvm-lto2 run -use-new-pm -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.thinltonewpm1.bc,fn,plx \ // RUN: -r %t.thinltonewpm1.bc,use,lx \ // RUN: -r %t.thinltonewpm1.bc,use_local,plx \ @@ -41,7 +41,7 @@ // Full LTO: both are safe. // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -flto=full -o %t.ltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc -// RUN: llvm-lto2 run -use-new-pm -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ +// RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \ // RUN: -r %t.ltonewpm1.bc,fn,plx \ // RUN: -r %t.ltonewpm1.bc,use,lx \ // RUN: -r %t.ltonewpm1.bc,use_local,plx \ @@ -52,7 +52,7 @@ // Thin LTO: both are safe. // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c %s -flto=thin -o %t.thinltonewpm1.bc // RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc -// RUN: llvm-lto2 run -use-new-pm -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc
[clang] 692a147 - [CGCall] Make findDominatingStoreToReturnValue() more robust
Author: Nikita Popov Date: 2022-04-08T15:18:12+02:00 New Revision: 692a147bf4339380ccfea7418cbedcea540cfaef URL: https://github.com/llvm/llvm-project/commit/692a147bf4339380ccfea7418cbedcea540cfaef DIFF: https://github.com/llvm/llvm-project/commit/692a147bf4339380ccfea7418cbedcea540cfaef.diff LOG: [CGCall] Make findDominatingStoreToReturnValue() more robust This was skipping specific lifetime + bitcast patterns, but with opaque pointers the bitcast will not be present, and we did not perform this fold. Instead skip over lifetime.end and bitcasts generally, without trying to correlate them. Added: clang/test/CodeGen/dominating-store-to-return.c Modified: clang/lib/CodeGen/CGCall.cpp Removed: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index e2ffd57dcbd0e..c4d342e3d2aaa 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3242,28 +3242,19 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction ) { if (!CGF.ReturnValue.getPointer()->hasOneUse()) { llvm::BasicBlock *IP = CGF.Builder.GetInsertBlock(); if (IP->empty()) return nullptr; -llvm::Instruction *I = >back(); - -// Skip lifetime markers -for (llvm::BasicBlock::reverse_iterator II = IP->rbegin(), -IE = IP->rend(); - II != IE; ++II) { - if (llvm::IntrinsicInst *Intrinsic = - dyn_cast(&*II)) { -if (Intrinsic->getIntrinsicID() == llvm::Intrinsic::lifetime_end) { - const llvm::Value *CastAddr = Intrinsic->getArgOperand(1); - ++II; - if (II == IE) -break; - if (isa(&*II) && (CastAddr == &*II)) -continue; -} - } - I = &*II; - break; -} -return GetStoreIfValid(I); +// Look at directly preceding instruction, skipping bitcasts and lifetime +// markers. +for (llvm::Instruction : make_range(IP->rbegin(), IP->rend())) { + if (isa()) +continue; + if (auto *II = dyn_cast()) +if (II->getIntrinsicID() == llvm::Intrinsic::lifetime_end) + continue; + + return GetStoreIfValid(); +} +return nullptr; } llvm::StoreInst *store = diff --git a/clang/test/CodeGen/dominating-store-to-return.c b/clang/test/CodeGen/dominating-store-to-return.c new file mode 100644 index 0..42595c5296098 --- /dev/null +++ b/clang/test/CodeGen/dominating-store-to-return.c @@ -0,0 +1,28 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=NO-LIFETIME +// RUN: %clang_cc1 -opaque-pointers -O1 -disable-llvm-optzns -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=LIFETIME + +// NO-LIFETIME-LABEL: @main( +// NO-LIFETIME-NEXT: entry: +// NO-LIFETIME-NEXT:[[RETVAL:%.*]] = alloca i32, align 4 +// NO-LIFETIME-NEXT:[[FOO:%.*]] = alloca i32, align 4 +// NO-LIFETIME-NEXT:[[FOO2:%.*]] = alloca i32, align 4 +// NO-LIFETIME-NEXT:store i32 0, ptr [[RETVAL]], align 4 +// NO-LIFETIME-NEXT:ret i32 0 +// +// LIFETIME-LABEL: @main( +// LIFETIME-NEXT: entry: +// LIFETIME-NEXT:[[RETVAL:%.*]] = alloca i32, align 4 +// LIFETIME-NEXT:[[FOO:%.*]] = alloca i32, align 4 +// LIFETIME-NEXT:[[FOO2:%.*]] = alloca i32, align 4 +// LIFETIME-NEXT:store i32 0, ptr [[RETVAL]], align 4 +// LIFETIME-NEXT:call void @llvm.lifetime.start.p0(i64 4, ptr [[FOO]]) #[[ATTR2:[0-9]+]] +// LIFETIME-NEXT:call void @llvm.lifetime.start.p0(i64 4, ptr [[FOO2]]) #[[ATTR2]] +// LIFETIME-NEXT:call void @llvm.lifetime.end.p0(i64 4, ptr [[FOO2]]) #[[ATTR2]] +// LIFETIME-NEXT:call void @llvm.lifetime.end.p0(i64 4, ptr [[FOO]]) #[[ATTR2]] +// LIFETIME-NEXT:ret i32 0 +// +int main() { + unsigned foo, foo2; + return 0; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 82d0f7b - [Clang] Remove redundant -no-opaque-pointers flag in test (NFC)
Author: Nikita Popov Date: 2022-04-07T13:53:37+02:00 New Revision: 82d0f7bdb5b542118f54aa03fac52e7a8f776123 URL: https://github.com/llvm/llvm-project/commit/82d0f7bdb5b542118f54aa03fac52e7a8f776123 DIFF: https://github.com/llvm/llvm-project/commit/82d0f7bdb5b542118f54aa03fac52e7a8f776123.diff LOG: [Clang] Remove redundant -no-opaque-pointers flag in test (NFC) This was accidentally caught in an automated replacement. This test is testing the -opaque-pointers flag itself, so we shouldn't add -no-opaque-pointers here (though it doesn't hurt either). Also drop the line testing the default, as the default is now determined by a cmake option. Added: Modified: clang/test/CodeGen/opaque-pointers-flag.c Removed: diff --git a/clang/test/CodeGen/opaque-pointers-flag.c b/clang/test/CodeGen/opaque-pointers-flag.c index 9199d9493fea4..2c6e4b02a8eaa 100644 --- a/clang/test/CodeGen/opaque-pointers-flag.c +++ b/clang/test/CodeGen/opaque-pointers-flag.c @@ -1,8 +1,6 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -no-opaque-pointers -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED -// RUN: %clang_cc1 -no-opaque-pointers -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE -// The current default is typed pointers: // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED +// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE // TYPED-LABEL: @test( // TYPED-NEXT: entry: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b16a3b4 - [Clang] Add -no-opaque-pointers to more tests (NFC)
Author: Nikita Popov Date: 2022-04-07T12:53:29+02:00 New Revision: b16a3b4f3bbd6f9f1f8d3a1525804dd5754c0adf URL: https://github.com/llvm/llvm-project/commit/b16a3b4f3bbd6f9f1f8d3a1525804dd5754c0adf DIFF: https://github.com/llvm/llvm-project/commit/b16a3b4f3bbd6f9f1f8d3a1525804dd5754c0adf.diff LOG: [Clang] Add -no-opaque-pointers to more tests (NFC) This adds the flag to more tests that were not caught by the mass-migration in 532dc62b907554b3f07f17205674aa71e76fc863. Added: Modified: clang/test/CodeGen/PowerPC/ppc-emmintrin.c clang/test/CodeGen/PowerPC/ppc-mmintrin.c clang/test/CodeGen/PowerPC/ppc-pmmintrin.c clang/test/CodeGen/PowerPC/ppc-smmintrin.c clang/test/CodeGen/PowerPC/ppc-tmmintrin.c clang/test/CodeGen/PowerPC/ppc-x86gprintrin.c clang/test/CodeGen/PowerPC/ppc-xmmintrin.c clang/test/CodeGen/PowerPC/vector-compat-pixel-bool-ternary.c clang/test/CodeGen/PowerPC/vector-compat-pixel-bool.c clang/test/CodeGen/PowerPC/vector-compat-ternary.c clang/test/CodeGen/PowerPC/vector-compat.c clang/test/CodeGen/extern-inline.c clang/test/CodeGen/ffp-contract-option.c clang/test/CodeGen/ffp-model.c clang/test/CodeGen/lifetime-sanitizer.c clang/test/CodeGen/sancov-new-pm.c clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu clang/test/CodeGenCUDASPIRV/kernel-argument.cu clang/test/CodeGenCXX/cxx-apple-kext.cpp clang/test/CodeGenCXX/debug-info-nrvo.cpp clang/test/CodeGenCXX/debug-info-template.cpp clang/test/CodeGenCXX/float16-declarations.cpp clang/test/CodeGenCXX/lifetime-sanitizer.cpp clang/test/CodeGenCXX/virtual-function-elimination.cpp clang/test/CodeGenObjC/objc_copyStruct.m clang/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl clang/test/Frontend/fixed_point_same_fbits.c clang/test/Headers/wasm.c clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.plain.expected clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected Removed: diff --git a/clang/test/CodeGen/PowerPC/ppc-emmintrin.c b/clang/test/CodeGen/PowerPC/ppc-emmintrin.c index 1163ba3ad5753..00da13fcf69ce 100644 --- a/clang/test/CodeGen/PowerPC/ppc-emmintrin.c +++ b/clang/test/CodeGen/PowerPC/ppc-emmintrin.c @@ -1,11 +1,11 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ +// RUN: %clang -Xclang -no-opaque-pointers -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ // RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE -// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ +// RUN: %clang -Xclang -no-opaque-pointers -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ // RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE -// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr10 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \ +// RUN: %clang -Xclang -no-opaque-pointers -S -emit-llvm -target
[clang] 5390606 - [OpaquePtr][Clang] Add CLANG_ENABLE_OPAQUE_POINTERS cmake option
Author: Nikita Popov Date: 2022-04-07T10:14:56+02:00 New Revision: 5390606aa963a7b415da65aa8120efbbafd30401 URL: https://github.com/llvm/llvm-project/commit/5390606aa963a7b415da65aa8120efbbafd30401 DIFF: https://github.com/llvm/llvm-project/commit/5390606aa963a7b415da65aa8120efbbafd30401.diff LOG: [OpaquePtr][Clang] Add CLANG_ENABLE_OPAQUE_POINTERS cmake option This option controls whether -opaque-pointers or -no-opaque-pointers is the default. Once opaque pointers are enabled by default, this will provide a simple way to temporarily opt-out of the change. Differential Revision: https://reviews.llvm.org/D123122 Added: Modified: clang/CMakeLists.txt clang/include/clang/Config/config.h.cmake clang/include/clang/Driver/Options.td Removed: diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 931eecd9c9681..3a77e7b0c8d60 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -247,6 +247,17 @@ set(CLANG_SPAWN_CC1 OFF CACHE BOOL option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" ON) +# Manually handle default so we can change the meaning of a cached default. +set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING +"Enable opaque pointers by default") +if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT") + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF) +elseif(CLANG_ENABLE_OPAQUE_POINTERS) + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON) +else() + set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF) +endif() + # TODO: verify the values against LangStandards.def? set(CLANG_DEFAULT_STD_C "" CACHE STRING "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)") diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake index 10a93293c0512..680cc7310f76d 100644 --- a/clang/include/clang/Config/config.h.cmake +++ b/clang/include/clang/Config/config.h.cmake @@ -89,4 +89,7 @@ /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */ #cmakedefine01 CLANG_SPAWN_CC1 +/* Whether to enable opaque pointers by default */ +#cmakedefine01 CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL + #endif diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 486276546770a..0f7cfa7eb883f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5507,7 +5507,7 @@ defm enable_noundef_analysis : BoolOption<"", defm opaque_pointers : BoolOption<"", "opaque-pointers", CodeGenOpts<"OpaquePointers">, - DefaultFalse, + Default<"CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL">, PosFlag, NegFlag, BothFlags<[], " opaque pointers">>; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f348ca5 - [Tests] Use %clang_cc1 instead of %clang -cc1 in codegen tests (NFC)
Author: Nikita Popov Date: 2022-04-05T13:21:44+02:00 New Revision: f348ca51c741580761e7ddefa1a8a0713494c20e URL: https://github.com/llvm/llvm-project/commit/f348ca51c741580761e7ddefa1a8a0713494c20e DIFF: https://github.com/llvm/llvm-project/commit/f348ca51c741580761e7ddefa1a8a0713494c20e.diff LOG: [Tests] Use %clang_cc1 instead of %clang -cc1 in codegen tests (NFC) Added: Modified: clang/test/CodeGen/attr-noundef.cpp clang/test/CodeGen/indirect-noundef.cpp clang/test/CodeGen/label-array-aggregate-init.c clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c clang/test/CodeGenCXX/debug-info-ctor-homing-flag.cpp clang/test/CodeGenCXX/debug-info-limited-ctor.cpp clang/test/CodeGenOpenCL/ext-int-shift.cl Removed: diff --git a/clang/test/CodeGen/attr-noundef.cpp b/clang/test/CodeGen/attr-noundef.cpp index 70b1f864b96ab..2f0e1899f61e3 100644 --- a/clang/test/CodeGen/attr-noundef.cpp +++ b/clang/test/CodeGen/attr-noundef.cpp @@ -1,11 +1,11 @@ -// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL -// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH -// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL -// RUN: %clang -cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL +// RUN: %clang_cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL +// RUN: %clang_cc1 -triple aarch64-gnu-linux -x c++ -S -emit-llvm -fsanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-AARCH // no-sanitize-memory-param-retval does NOT conflict with enable-noundef-analysis -// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fno-sanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL -// RUN: %clang -cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fno-sanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fno-sanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL +// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -S -emit-llvm -fno-sanitize-memory-param-retval %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INTEL // Passing structs by value // TODO: No structs may currently be marked noundef diff --git a/clang/test/CodeGen/indirect-noundef.cpp b/clang/test/CodeGen/indirect-noundef.cpp index aa03bbfe74d5e..87f1658f4a7f5 100644 --- a/clang/test/CodeGen/indirect-noundef.cpp +++ b/clang/test/CodeGen/indirect-noundef.cpp @@ -1,9 +1,9 @@ -// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fsanitize-memory-param-retval -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fsanitize-memory-param-retval -o - %s | FileCheck %s // no-sanitize-memory-param-retval does NOT conflict with enable-noundef-analysis -// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fno-sanitize-memory-param-retval -o - %s | FileCheck %s -// RUN: %clang -cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fno-sanitize-memory-param-retval -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fno-sanitize-memory-param-retval -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -fno-sanitize-memory-param-retval -o - %s | FileCheck %s union u1 { int val; diff --git a/clang/test/CodeGen/label-array-aggregate-init.c b/clang/test/CodeGen/label-array-aggregate-init.c index 48c7e1c727381..cc1571d44d5f4 100644 --- a/clang/test/CodeGen/label-array-aggregate-init.c +++ b/clang/test/CodeGen/label-array-aggregate-init.c @@ -1,4 +1,4 @@ -// RUN: %clang -cc1 -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s //
[clang] b1f610f - [Test] Use cc1 interface in more tests (NFC)
Author: Nikita Popov Date: 2022-04-05T13:16:24+02:00 New Revision: b1f610fec54a0083f0086788c404484359a1a48e URL: https://github.com/llvm/llvm-project/commit/b1f610fec54a0083f0086788c404484359a1a48e DIFF: https://github.com/llvm/llvm-project/commit/b1f610fec54a0083f0086788c404484359a1a48e.diff LOG: [Test] Use cc1 interface in more tests (NFC) There doesn't seem to be any particular reason why these tests use the driver interface rather than the cc1 interface, which is typically used in CodeGen tests. Added: Modified: clang/test/CodeGen/bpf-attr-preserve-access-index-1.c clang/test/CodeGen/bpf-attr-preserve-access-index-2.c clang/test/CodeGen/bpf-attr-preserve-access-index-3.c clang/test/CodeGen/bpf-attr-preserve-access-index-4.c clang/test/CodeGen/bpf-attr-preserve-access-index-5.c clang/test/CodeGen/bpf-attr-preserve-access-index-6.c clang/test/CodeGen/bpf-attr-preserve-access-index-7.c clang/test/CodeGen/bpf-attr-preserve-access-index-8.c clang/test/CodeGen/bpf-inline-asm.c clang/test/CodeGen/builtin-preserve-access-index-array.c clang/test/CodeGen/builtin-preserve-access-index-nonptr.c clang/test/CodeGen/builtin-preserve-access-index-typedef.c clang/test/CodeGen/builtin-preserve-access-index.c clang/test/CodeGen/builtins-bpf-preserve-field-info-1.c clang/test/CodeGen/builtins-bpf-preserve-field-info-2.c clang/test/CodeGen/builtins-bpf-preserve-field-info-3.c clang/test/CodeGen/builtins-bpf-preserve-field-info-4.c clang/test/CodeGen/builtinshufflevector2.c clang/test/CodeGen/mips-constraints-mem.c clang/test/CodeGen/mips-inline-asm-modifiers.c clang/test/CodeGen/mips64-nontrivial-return.cpp Removed: diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-1.c b/clang/test/CodeGen/bpf-attr-preserve-access-index-1.c index 956b333f81520..babafeae34d78 100644 --- a/clang/test/CodeGen/bpf-attr-preserve-access-index-1.c +++ b/clang/test/CodeGen/bpf-attr-preserve-access-index-1.c @@ -1,5 +1,5 @@ // REQUIRES: bpf-registered-target -// RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s #define __reloc__ __attribute__((preserve_access_index)) diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-2.c b/clang/test/CodeGen/bpf-attr-preserve-access-index-2.c index 8fe11e08c833f..1cea1d829e4b9 100644 --- a/clang/test/CodeGen/bpf-attr-preserve-access-index-2.c +++ b/clang/test/CodeGen/bpf-attr-preserve-access-index-2.c @@ -1,5 +1,5 @@ // REQUIRES: bpf-registered-target -// RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s #define __reloc__ __attribute__((preserve_access_index)) diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-3.c b/clang/test/CodeGen/bpf-attr-preserve-access-index-3.c index f78e0b35c0b51..e917b5bde865c 100644 --- a/clang/test/CodeGen/bpf-attr-preserve-access-index-3.c +++ b/clang/test/CodeGen/bpf-attr-preserve-access-index-3.c @@ -1,5 +1,5 @@ // REQUIRES: bpf-registered-target -// RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s #define __reloc__ __attribute__((preserve_access_index)) diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-4.c b/clang/test/CodeGen/bpf-attr-preserve-access-index-4.c index 6d3c44328c6ef..c9367e54e4541 100644 --- a/clang/test/CodeGen/bpf-attr-preserve-access-index-4.c +++ b/clang/test/CodeGen/bpf-attr-preserve-access-index-4.c @@ -1,5 +1,5 @@ // REQUIRES: bpf-registered-target -// RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s #define __reloc__ __attribute__((preserve_access_index)) diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-5.c b/clang/test/CodeGen/bpf-attr-preserve-access-index-5.c index 286916a990e63..10a8cbc5dd61e 100644 --- a/clang/test/CodeGen/bpf-attr-preserve-access-index-5.c +++ b/clang/test/CodeGen/bpf-attr-preserve-access-index-5.c @@ -1,5 +1,5 @@ // REQUIRES: bpf-registered-target -// RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple bpf -emit-llvm -debug-info-kind=limited -disable-llvm-passes %s -o - | FileCheck %s #define __reloc__ __attribute__((preserve_access_index)) diff --git a/clang/test/CodeGen/bpf-attr-preserve-access-index-6.c
[clang] 4d8a74c - [Test] Use cc1 instead of mllvm -opaque-pointers option (NFC)
Author: Nikita Popov Date: 2022-04-05T12:04:48+02:00 New Revision: 4d8a74c460eb9ec46f913375c92fa8c2359ddc22 URL: https://github.com/llvm/llvm-project/commit/4d8a74c460eb9ec46f913375c92fa8c2359ddc22 DIFF: https://github.com/llvm/llvm-project/commit/4d8a74c460eb9ec46f913375c92fa8c2359ddc22.diff LOG: [Test] Use cc1 instead of mllvm -opaque-pointers option (NFC) Added: Modified: clang/test/CoverageMapping/ir.c Removed: diff --git a/clang/test/CoverageMapping/ir.c b/clang/test/CoverageMapping/ir.c index bd1eeb450d4c9..62276189b98e9 100644 --- a/clang/test/CoverageMapping/ir.c +++ b/clang/test/CoverageMapping/ir.c @@ -1,6 +1,6 @@ // Check the data structures emitted by coverage mapping -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -mllvm -opaque-pointers=0 | FileCheck %s -check-prefixes=COMMON,DARWIN -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -mllvm -opaque-pointers=1 | FileCheck %s -check-prefixes=COMMON,DARWIN +// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -no-opaque-pointers | FileCheck %s -check-prefixes=COMMON,DARWIN +// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -opaque-pointers | FileCheck %s -check-prefixes=COMMON,DARWIN // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64--windows-msvc -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false | FileCheck %s -check-prefixes=COMMON,WINDOWS static inline void unused(void) {} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 46cfbe5 - [LLVMContext] Replace enableOpaquePointers() with setOpaquePointers()
Author: Nikita Popov Date: 2022-04-05T12:02:48+02:00 New Revision: 46cfbe561bfd3b35984b3e1662bd2bca4eb9e96d URL: https://github.com/llvm/llvm-project/commit/46cfbe561bfd3b35984b3e1662bd2bca4eb9e96d DIFF: https://github.com/llvm/llvm-project/commit/46cfbe561bfd3b35984b3e1662bd2bca4eb9e96d.diff LOG: [LLVMContext] Replace enableOpaquePointers() with setOpaquePointers() This allows both explicitly enabling and explicitly disabling opaque pointers, in anticipation of the default switching at some point. This also slightly changes the rules by allowing calls if either the opaque pointer mode has not yet been set (explicitly or implicitly) or if the value remains unchanged. Added: Modified: clang/lib/CodeGen/CodeGenAction.cpp llvm/include/llvm/IR/LLVMContext.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/IR/LLVMContext.cpp llvm/lib/IR/LLVMContextImpl.cpp llvm/unittests/IR/ConstantsTest.cpp llvm/unittests/IR/TypesTest.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 25f4cbbc700a5..b8ed3534de8be 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -984,7 +984,7 @@ CodeGenAction::CreateASTConsumer(CompilerInstance , StringRef InFile) { return nullptr; if (CI.getCodeGenOpts().OpaquePointers) -VMContext->enableOpaquePointers(); +VMContext->setOpaquePointers(true); // Load bitcode modules to link with, if we need to. if (LinkModules.empty()) diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h index d80d54693258a..73e2326b8fe3e 100644 --- a/llvm/include/llvm/IR/LLVMContext.h +++ b/llvm/include/llvm/IR/LLVMContext.h @@ -308,9 +308,11 @@ class LLVMContext { /// Whether we've decided on using opaque pointers or typed pointers yet. bool hasSetOpaquePointersValue() const; - /// Enable opaque pointers. Can only be called before creating the first - /// pointer type. - void enableOpaquePointers() const; + /// Set whether opaque pointers are enabled. The method may be called multiple + /// times, but only with the same value. Note that creating a pointer type or + /// otherwise querying the opaque pointer mode performs an implicit set to + /// the default value. + void setOpaquePointers(bool Enable) const; /// Whether typed pointers are supported. If false, all pointers are opaque. bool supportsTypedPointers() const; diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 8aac5a66c6232..2a091a9c94f8e 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -860,9 +860,9 @@ lltok::Kind LLLexer::LexIdentifier() { TYPEKEYWORD("token", Type::getTokenTy(Context)); if (Keyword == "ptr") { -// enableOpaquePointers() must be called before creating any pointer types. +// setOpaquePointers() must be called before creating any pointer types. if (!Context.hasSetOpaquePointersValue()) { - Context.enableOpaquePointers(); + Context.setOpaquePointers(true); } else if (Context.supportsTypedPointers()) { Warning("ptr type is only supported in -opaque-pointers mode"); return lltok::Error; diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 034fa5832ba84..8a5074941b979 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1884,7 +1884,7 @@ Error BitcodeReader::parseTypeTableBody() { if (Record.size() != 1) return error("Invalid opaque pointer record"); if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) { -Context.enableOpaquePointers(); +Context.setOpaquePointers(true); } else if (Context.supportsTypedPointers()) return error( "Opaque pointers are only supported in -opaque-pointers mode"); diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index f4e917cc89920..c9b0d957aa887 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -355,10 +355,8 @@ bool LLVMContext::hasSetOpaquePointersValue() const { return pImpl->hasOpaquePointersValue(); } -void LLVMContext::enableOpaquePointers() const { - assert(pImpl->PointerTypes.empty() && pImpl->ASPointerTypes.empty() && - "Must be called before creating any pointer types"); - pImpl->setOpaquePointers(true); +void LLVMContext::setOpaquePointers(bool Enable) const { + pImpl->setOpaquePointers(Enable); } bool LLVMContext::supportsTypedPointers() const { diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index 1d115e50021b2..ed192275aabed 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -259,4 +259,8 @@ bool
[clang] ff18b15 - [CodeGen] Avoid unnecessary ConstantExpr cast
Author: Nikita Popov Date: 2022-04-05T11:28:40+02:00 New Revision: ff18b158edc4719c4b05cd04dceaedcf69a8d9c5 URL: https://github.com/llvm/llvm-project/commit/ff18b158edc4719c4b05cd04dceaedcf69a8d9c5 DIFF: https://github.com/llvm/llvm-project/commit/ff18b158edc4719c4b05cd04dceaedcf69a8d9c5.diff LOG: [CodeGen] Avoid unnecessary ConstantExpr cast With opaque pointers, this is not necessarily a ConstantExpr. And we don't need one here either, just Constant is sufficient. Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d637ab6ec288d..4d24c33f51d02 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5407,7 +5407,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { auto Fields = Builder.beginStruct(STy); // Class pointer. - Fields.add(cast(CFConstantStringClassRef)); + Fields.add(cast(CFConstantStringClassRef)); // Flags. if (IsSwiftABI) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] d69e9f9 - [OpaquePtrs][Clang] Add -opaque-pointers/-no-opaque-pointers cc1 options
Author: Nikita Popov Date: 2022-04-05T10:15:41+02:00 New Revision: d69e9f9d8978399a9d1f1c1ed62aa661440afcd3 URL: https://github.com/llvm/llvm-project/commit/d69e9f9d8978399a9d1f1c1ed62aa661440afcd3 DIFF: https://github.com/llvm/llvm-project/commit/d69e9f9d8978399a9d1f1c1ed62aa661440afcd3.diff LOG: [OpaquePtrs][Clang] Add -opaque-pointers/-no-opaque-pointers cc1 options This adds cc1 options for enabling and disabling opaque pointers on the clang side. This is not super useful now (because -mllvm -opaque-pointers and -Xclang -opaque-pointers have the same visible effect) but will be important once opaque pointers are enabled by default in clang. In that case, it will only be possible to disable them using the cc1 -no-opaque-pointers option. Differential Revision: https://reviews.llvm.org/D123034 Added: clang/test/CodeGen/opaque-pointers-flag.c Modified: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td clang/lib/CodeGen/CodeGenAction.cpp Removed: diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 3301e7587d216..720a59ff1bdce 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -469,6 +469,9 @@ CODEGENOPT(SkipRaxSetup, 1, 0) ENUM_CODEGENOPT(ZeroCallUsedRegs, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind, 5, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Skip) +/// Whether to use opaque pointers. +CODEGENOPT(OpaquePointers, 1, 0) + #undef CODEGENOPT #undef ENUM_CODEGENOPT #undef VALUE_CODEGENOPT diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 2dc28bab08ca4..bc5aa1a37d0f2 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5504,6 +5504,13 @@ defm enable_noundef_analysis : BoolOption<"", PosFlag, NegFlag, BothFlags<[], " analyzing function argument and return types for mandatory definedness">>; +defm opaque_pointers : BoolOption<"", + "opaque-pointers", + CodeGenOpts<"OpaquePointers">, + DefaultFalse, + PosFlag, + NegFlag, + BothFlags<[], " opaque pointers">>; def discard_value_names : Flag<["-"], "discard-value-names">, HelpText<"Discard value names in LLVM IR">, MarshallingInfoFlag>; diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 807880fd4fd7a..25f4cbbc700a5 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -983,6 +983,9 @@ CodeGenAction::CreateASTConsumer(CompilerInstance , StringRef InFile) { if (BA != Backend_EmitNothing && !OS) return nullptr; + if (CI.getCodeGenOpts().OpaquePointers) +VMContext->enableOpaquePointers(); + // Load bitcode modules to link with, if we need to. if (LinkModules.empty()) for (const CodeGenOptions::BitcodeFileToLink : diff --git a/clang/test/CodeGen/opaque-pointers-flag.c b/clang/test/CodeGen/opaque-pointers-flag.c new file mode 100644 index 0..c4d4bb1619c2e --- /dev/null +++ b/clang/test/CodeGen/opaque-pointers-flag.c @@ -0,0 +1,27 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED +// RUN: %clang_cc1 -opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=OPAQUE +// The current default is typed pointers: +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=TYPED + +// TYPED-LABEL: @test( +// TYPED-NEXT: entry: +// TYPED-NEXT:[[P_ADDR:%.*]] = alloca i32*, align 8 +// TYPED-NEXT:store i32* [[P:%.*]], i32** [[P_ADDR]], align 8 +// TYPED-NEXT:[[TMP0:%.*]] = load i32*, i32** [[P_ADDR]], align 8 +// TYPED-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1 +// TYPED-NEXT:[[TMP1:%.*]] = load i32, i32* [[ARRAYIDX]], align 4 +// TYPED-NEXT:ret i32 [[TMP1]] +// +// OPAQUE-LABEL: @test( +// OPAQUE-NEXT: entry: +// OPAQUE-NEXT:[[P_ADDR:%.*]] = alloca ptr, align 8 +// OPAQUE-NEXT:store ptr [[P:%.*]], ptr [[P_ADDR]], align 8 +// OPAQUE-NEXT:[[TMP0:%.*]] = load ptr, ptr [[P_ADDR]], align 8 +// OPAQUE-NEXT:[[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1 +// OPAQUE-NEXT:[[TMP1:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 +// OPAQUE-NEXT:ret i32 [[TMP1]] +// +int test(int *p) { + return p[1]; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8a72391 - [IR] Require intrinsic struct return type to be anonymous
Author: Nikita Popov Date: 2022-03-30T09:51:24+02:00 New Revision: 8a72391f609f016b0aef17e728aca65027a80cc4 URL: https://github.com/llvm/llvm-project/commit/8a72391f609f016b0aef17e728aca65027a80cc4 DIFF: https://github.com/llvm/llvm-project/commit/8a72391f609f016b0aef17e728aca65027a80cc4.diff LOG: [IR] Require intrinsic struct return type to be anonymous This is an alternative to D122376. Rather than working around the problem, this patch requires that struct return types in intrinsics are anonymous/literal and adds auto-upgrade code to convert existing uses of intrinsics with named struct types. This ensures that the mapping between intrinsic name and intrinsic function type is actually bijective, as it is supposed to be. This also fixes https://github.com/llvm/llvm-project/issues/37891. Differential Revision: https://reviews.llvm.org/D122471 Added: llvm/test/Bitcode/intrinsics-struct-upgrade.ll llvm/test/Bitcode/intrinsics-struct-upgrade.ll.bc Modified: clang/test/CodeGenCUDA/texture.cu llvm/lib/IR/AutoUpgrade.cpp llvm/lib/IR/Function.cpp llvm/test/CodeGen/X86/2009-04-12-FastIselOverflowCrash.ll llvm/test/CodeGen/X86/fast-isel-extract.ll Removed: diff --git a/clang/test/CodeGenCUDA/texture.cu b/clang/test/CodeGenCUDA/texture.cu index 031d238e507cc..f7ac5cc739d6f 100644 --- a/clang/test/CodeGenCUDA/texture.cu +++ b/clang/test/CodeGenCUDA/texture.cu @@ -5,6 +5,9 @@ // RUN: echo "GPU binary would be here" > %t // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -target-sdk-version=8.0 -fcuda-include-gpubinary %t -emit-llvm -o - %s | FileCheck --check-prefix=HOST %s +// Accessing nvvm intrinsics in this way no longer works. +// XFAIL: * + struct textureReference { int desc; }; diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index da01227a4c4a4..bf52b098d8d88 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -576,19 +576,6 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *) { F->arg_begin()->getType()); return true; } -static const Regex vldRegex("^arm\\.neon\\.vld([1234]|[234]lane)\\.v[a-z0-9]*$"); -if (vldRegex.match(Name)) { - auto fArgs = F->getFunctionType()->params(); - SmallVector Tys(fArgs.begin(), fArgs.end()); - // Can't use Intrinsic::getDeclaration here as the return types might - // then only be structurally equal. - FunctionType* fType = FunctionType::get(F->getReturnType(), Tys, false); - StringRef Suffix = - F->getContext().supportsTypedPointers() ? "p0i8" : "p0"; - NewFn = Function::Create(fType, F->getLinkage(), F->getAddressSpace(), - "llvm." + Name + "." + Suffix, F->getParent()); - return true; -} static const Regex vstRegex("^arm\\.neon\\.vst([1234]|[234]lane)\\.v[a-z0-9]*$"); if (vstRegex.match(Name)) { static const Intrinsic::ID StoreInts[] = {Intrinsic::arm_neon_vst1, @@ -1017,6 +1004,25 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *) { if (UpgradeX86IntrinsicFunction(F, Name, NewFn)) return true; } + + if (auto *ST = dyn_cast(F->getReturnType())) { +if (!ST->isLiteral() || ST->isPacked()) { + // Replace return type with literal non-packed struct. + auto *FT = F->getFunctionType(); + auto *NewST = StructType::get(ST->getContext(), ST->elements()); + auto *NewFT = FunctionType::get(NewST, FT->params(), FT->isVarArg()); + std::string Name = F->getName().str(); + rename(F); + NewFn = Function::Create(NewFT, F->getLinkage(), F->getAddressSpace(), + Name, F->getParent()); + + // The new function may also need remangling. + if (auto Result = llvm::Intrinsic::remangleIntrinsicFunction(F)) +NewFn = *Result; + return true; +} + } + // Remangle our intrinsic since we upgrade the mangling auto Result = llvm::Intrinsic::remangleIntrinsicFunction(F); if (Result != None) { @@ -3784,12 +3790,33 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) { return; } - const auto = [, ]() -> void { -// Handle generic mangling change, but nothing else -assert( -(CI->getCalledFunction()->getName() != NewFn->getName()) && -"Unknown function for CallBase upgrade and isn't just a name change"); -CI->setCalledFunction(NewFn); + const auto = [&]() -> void { +if (CI->getFunctionType() == NewFn->getFunctionType()) { + // Handle generic mangling change. + assert( + (CI->getCalledFunction()->getName() != NewFn->getName()) && + "Unknown function for CallBase upgrade and isn't just a name change"); + CI->setCalledFunction(NewFn); + return; +} + +// This must be an upgrade from a named to a literal
[clang] a8690ba - [CGExpr] Perform bitcast unconditionally
Author: Nikita Popov Date: 2022-03-23T15:39:39+01:00 New Revision: a8690ba9d0147bbca8d9031ef1596c4de025e6ed URL: https://github.com/llvm/llvm-project/commit/a8690ba9d0147bbca8d9031ef1596c4de025e6ed DIFF: https://github.com/llvm/llvm-project/commit/a8690ba9d0147bbca8d9031ef1596c4de025e6ed.diff LOG: [CGExpr] Perform bitcast unconditionally The way the check is written is not compatible with opaque pointers -- while we don't need to change the IR pointer type, we do need to change the element type stored in the Address. Added: Modified: clang/lib/CodeGen/CGExpr.cpp Removed: diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 2ee62f97399ac..45059cafabb58 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2750,8 +2750,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType()); auto *PTy = llvm::PointerType::get( VarTy, getContext().getTargetAddressSpace(VD->getType())); -if (PTy != Addr.getType()) - Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy); +Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy); } else { // Should we be using the alignment of the constant pointer we emitted? CharUnits Alignment = ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ba36556 - [InstrProfiling] Account for missing bitcast/GEP
Author: Nikita Popov Date: 2022-03-23T15:39:39+01:00 New Revision: ba365561455e467664df8c656f111b26fd1f81de URL: https://github.com/llvm/llvm-project/commit/ba365561455e467664df8c656f111b26fd1f81de DIFF: https://github.com/llvm/llvm-project/commit/ba365561455e467664df8c656f111b26fd1f81de.diff LOG: [InstrProfiling] Account for missing bitcast/GEP This code is supposed to clean up a constexpr bitcast/GEP, but with opaque pointers this ends up dropping references to the global. Added: Modified: clang/test/CoverageMapping/ir.c llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp Removed: diff --git a/clang/test/CoverageMapping/ir.c b/clang/test/CoverageMapping/ir.c index 7dd23943f701a..bd1eeb450d4c9 100644 --- a/clang/test/CoverageMapping/ir.c +++ b/clang/test/CoverageMapping/ir.c @@ -1,5 +1,6 @@ // Check the data structures emitted by coverage mapping -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false | FileCheck %s -check-prefixes=COMMON,DARWIN +// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -mllvm -opaque-pointers=0 | FileCheck %s -check-prefixes=COMMON,DARWIN +// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64-apple-macosx10.9 -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false -mllvm -opaque-pointers=1 | FileCheck %s -check-prefixes=COMMON,DARWIN // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple x86_64--windows-msvc -main-file-name ir.c %s -o - -emit-llvm -fprofile-instrument=clang -fcoverage-mapping -mllvm -enable-name-compression=false | FileCheck %s -check-prefixes=COMMON,WINDOWS static inline void unused(void) {} @@ -24,7 +25,7 @@ int main(void) { // WINDOWS: [[FuncRecord3:@__covrec_[0-9A-F]+]] = linkonce_odr hidden constant <{ i64, i32, i64, i64, [{{.*}} x i8] }> <{ {{.*}} }>, section ".lcovfun$M", comdat, align 8 // WINDOWS: @__llvm_coverage_mapping = private constant { { i32, i32, i32, i32 }, [{{.*}} x i8] } { {{.*}} }, section ".lcovmap$M", align 8 -// COMMON: @llvm.used = appending global [{{.*}} x i8*] +// COMMON: @llvm.used = appending global [{{.*}}] [ // COMMON-SAME: [[FuncRecord1]] // COMMON-SAME: [[FuncRecord2]] // COMMON-SAME: [[FuncRecord3]] diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index dc5f2c01351d2..379c41ce66936 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -767,7 +767,8 @@ void InstrProfiling::lowerCoverageData(GlobalVariable *CoverageNamesVar) { Name->setLinkage(GlobalValue::PrivateLinkage); ReferencedNames.push_back(Name); -NC->dropAllReferences(); +if (isa(NC)) + NC->dropAllReferences(); } CoverageNamesVar->eraseFromParent(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 5c6752d - [CGObjCMac] Check global value type instead of poitner type
Author: Nikita Popov Date: 2022-03-23T15:39:39+01:00 New Revision: 5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1 URL: https://github.com/llvm/llvm-project/commit/5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1 DIFF: https://github.com/llvm/llvm-project/commit/5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1.diff LOG: [CGObjCMac] Check global value type instead of poitner type As we're going to reassign the initializer, we actually need the value types to match, not just the pointer types. This is only relevant with opaque pointers. Added: Modified: clang/lib/CodeGen/CGObjCMac.cpp Removed: diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index cbd7e82e60bd2..94d495a993835 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -7408,7 +7408,7 @@ CGObjCNonFragileABIMac::GetClassGlobal(StringRef Name, : llvm::GlobalValue::ExternalLinkage; llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name); - if (!GV || GV->getType() != ObjCTypes.ClassnfABITy->getPointerTo()) { + if (!GV || GV->getValueType() != ObjCTypes.ClassnfABITy) { auto *NewGV = new llvm::GlobalVariable(ObjCTypes.ClassnfABITy, false, L, nullptr, Name); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] beee096 - [CGBlocks] Don't assume presence of bitcast
Author: Nikita Popov Date: 2022-03-23T15:39:39+01:00 New Revision: beee09687f4602dba82a378bad94ed9657c97339 URL: https://github.com/llvm/llvm-project/commit/beee09687f4602dba82a378bad94ed9657c97339 DIFF: https://github.com/llvm/llvm-project/commit/beee09687f4602dba82a378bad94ed9657c97339.diff LOG: [CGBlocks] Don't assume presence of bitcast With opaque pointers, the bitcast constexpr will not be present. Added: Modified: clang/lib/CodeGen/CGBlocks.cpp Removed: diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 50f5435ddbcdf..ff6ca0914e0d1 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -216,8 +216,9 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule , llvm::Constant *disposeHelper = buildDisposeHelper(CGM, blockInfo); elements.add(disposeHelper); -if (cast(copyHelper->getOperand(0))->hasInternalLinkage() || -cast(disposeHelper->getOperand(0)) +if (cast(copyHelper->stripPointerCasts()) +->hasInternalLinkage() || +cast(disposeHelper->stripPointerCasts()) ->hasInternalLinkage()) hasInternalHelper = true; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits