[clang] e5aaf03 - [InstCombine] Update InstCombine to use poison instead of undef for shufflevector's placeholder (1/3)

2021-09-22 Thread hyeongyu kim via cfe-commits

Author: hyeongyu kim
Date: 2021-09-22T23:18:51+09:00
New Revision: e5aaf0332670577cc19ac67b07b10261da6fc1e1

URL: 
https://github.com/llvm/llvm-project/commit/e5aaf0332670577cc19ac67b07b10261da6fc1e1
DIFF: 
https://github.com/llvm/llvm-project/commit/e5aaf0332670577cc19ac67b07b10261da6fc1e1.diff

LOG: [InstCombine] Update InstCombine to use poison instead of undef for 
shufflevector's placeholder (1/3)

This patch is for fixing potential shufflevector-related bugs like D93818.
As D93818, this patch change shufflevector's default placeholder to poison.
To reduce risk, it was divided into several patches, and this patch is for 
InstCombineCasts.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D110226

Added: 


Modified: 
clang/test/Headers/wasm.c
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/X86/x86-f16c-inseltpoison.ll
llvm/test/Transforms/InstCombine/X86/x86-f16c.ll
llvm/test/Transforms/InstCombine/cast.ll
llvm/test/Transforms/InstCombine/shuffle-cast-dist.ll
llvm/test/Transforms/InstCombine/shufflevec-bitcast-inseltpoison.ll
llvm/test/Transforms/InstCombine/shufflevec-bitcast.ll
llvm/test/Transforms/InstCombine/trunc-inseltpoison.ll
llvm/test/Transforms/InstCombine/trunc.ll
llvm/test/Transforms/InstCombine/vector-casts.ll

Removed: 




diff  --git a/clang/test/Headers/wasm.c b/clang/test/Headers/wasm.c
index ce24f4269ab92..f4e4e9dad47aa 100644
--- a/clang/test/Headers/wasm.c
+++ b/clang/test/Headers/wasm.c
@@ -825,7 +825,7 @@ v128_t test_u64x2_replace_lane(v128_t a, uint64_t b) {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[VECINIT_I:%.*]] = insertelement <4 x float> undef, float 
[[A:%.*]], i32 0
 // CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x float> [[VECINIT_I]] to <4 x i32>
-// CHECK-NEXT:[[TMP1:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> 
undef, <4 x i32> zeroinitializer
+// CHECK-NEXT:[[TMP1:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> 
poison, <4 x i32> zeroinitializer
 // CHECK-NEXT:ret <4 x i32> [[TMP1]]
 //
 v128_t test_f32x4_splat(float a) {
@@ -1598,7 +1598,7 @@ v128_t test_i8x16_popcnt(v128_t a) {
 // CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x i32> [[A:%.*]] to <16 x i8>
 // CHECK-NEXT:[[TMP1:%.*]] = trunc i32 [[B:%.*]] to i8
 // CHECK-NEXT:[[TMP2:%.*]] = insertelement <16 x i8> undef, i8 [[TMP1]], 
i32 0
-// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> undef, <16 x i32> zeroinitializer
+// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> poison, <16 x i32> zeroinitializer
 // CHECK-NEXT:[[SHL_I:%.*]] = shl <16 x i8> [[TMP0]], [[SH_PROM_I]]
 // CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[SHL_I]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP3]]
@@ -1612,7 +1612,7 @@ v128_t test_i8x16_shl(v128_t a, uint32_t b) {
 // CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x i32> [[A:%.*]] to <16 x i8>
 // CHECK-NEXT:[[TMP1:%.*]] = trunc i32 [[B:%.*]] to i8
 // CHECK-NEXT:[[TMP2:%.*]] = insertelement <16 x i8> undef, i8 [[TMP1]], 
i32 0
-// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> undef, <16 x i32> zeroinitializer
+// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> poison, <16 x i32> zeroinitializer
 // CHECK-NEXT:[[SHR_I:%.*]] = ashr <16 x i8> [[TMP0]], [[SH_PROM_I]]
 // CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[SHR_I]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP3]]
@@ -1626,7 +1626,7 @@ v128_t test_i8x16_shr(v128_t a, uint32_t b) {
 // CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x i32> [[A:%.*]] to <16 x i8>
 // CHECK-NEXT:[[TMP1:%.*]] = trunc i32 [[B:%.*]] to i8
 // CHECK-NEXT:[[TMP2:%.*]] = insertelement <16 x i8> undef, i8 [[TMP1]], 
i32 0
-// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> undef, <16 x i32> zeroinitializer
+// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <16 x i8> [[TMP2]], <16 x 
i8> poison, <16 x i32> zeroinitializer
 // CHECK-NEXT:[[SHR_I:%.*]] = lshr <16 x i8> [[TMP0]], [[SH_PROM_I]]
 // CHECK-NEXT:[[TMP3:%.*]] = bitcast <16 x i8> [[SHR_I]] to <4 x i32>
 // CHECK-NEXT:ret <4 x i32> [[TMP3]]
@@ -1819,7 +1819,7 @@ uint32_t test_i16x8_bitmask(v128_t a) {
 // CHECK-NEXT:[[TMP0:%.*]] = bitcast <4 x i32> [[A:%.*]] to <8 x i16>
 // CHECK-NEXT:[[TMP1:%.*]] = trunc i32 [[B:%.*]] to i16
 // CHECK-NEXT:[[TMP2:%.*]] = insertelement <8 x i16> undef, i16 [[TMP1]], 
i32 0
-// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x 
i16> undef, <8 x i32> zeroinitializer
+// CHECK-NEXT:[[SH_PROM_I:%.*]] = shufflevector <8 x i16> [[TMP2]], <8 x 
i16> poison, <8 x i32> zeroinitializer
 // CHECK-NEXT:[[SHL_I:%.*]] = shl <8 x i16> [[TMP0]], [[SH_PROM_I]]
 // CHECK-NEXT:[[TMP3:%.*]] = bitcast <8 x i16> [[SHL_

[clang] 98e9666 - [InstCombine] Update InstCombine to use poison instead of undef for shufflevector's placeholder (3/3)

2021-09-22 Thread hyeongyu kim via cfe-commits

Author: hyeongyu kim
Date: 2021-09-23T00:48:24+09:00
New Revision: 98e96663f6a77ee06c5db3f25cdcf19b56ac8f04

URL: 
https://github.com/llvm/llvm-project/commit/98e96663f6a77ee06c5db3f25cdcf19b56ac8f04
DIFF: 
https://github.com/llvm/llvm-project/commit/98e96663f6a77ee06c5db3f25cdcf19b56ac8f04.diff

LOG: [InstCombine] Update InstCombine to use poison instead of undef for 
shufflevector's placeholder (3/3)

This patch is for fixing potential shufflevector-related bugs like D93818.
As D93818, this patch change shufflevector's default placeholder to poison.
To reduce risk, it was divided into several patches, and this patch is for 
InstCombineVectorOps.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D110230

Added: 


Modified: 
clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
clang/test/CodeGen/aarch64-neon-dot-product.c
clang/test/CodeGen/arm-neon-dot-product.c
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
llvm/test/Transforms/InstCombine/X86/x86-avx512.ll
llvm/test/Transforms/InstCombine/X86/x86-f16c-inseltpoison.ll
llvm/test/Transforms/InstCombine/X86/x86-f16c.ll
llvm/test/Transforms/InstCombine/broadcast-inseltpoison.ll
llvm/test/Transforms/InstCombine/broadcast.ll
llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
llvm/test/Transforms/InstCombine/obfuscated_splat-inseltpoison.ll
llvm/test/Transforms/InstCombine/obfuscated_splat.ll
llvm/test/Transforms/InstCombine/reduction-shufflevector.ll
llvm/test/Transforms/InstCombine/shuffle-cast-dist.ll
llvm/test/Transforms/InstCombine/trunc-inseltpoison.ll
llvm/test/Transforms/InstCombine/trunc.ll
llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll
llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
llvm/test/Transforms/InstCombine/vec_shuffle-inseltpoison.ll
llvm/test/Transforms/InstCombine/vec_shuffle.ll

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c 
b/clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
index 6772c37c9723e..a4d2901b5d474 100644
--- a/clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
+++ b/clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
@@ -53,11 +53,11 @@ bfloat16x4_t test_vld1_dup_bf16(bfloat16_t const *ptr) {
 // CHECK-LABEL: test_vld1_dup_bf16
 // CHECK64: %0 = load bfloat, bfloat* %ptr, align 2
 // CHECK64-NEXT: %1 = insertelement <4 x bfloat> undef, bfloat %0, i32 0
-// CHECK64-NEXT: %lane = shufflevector <4 x bfloat> %1, <4 x bfloat> undef, <4 
x i32> zeroinitializer
+// CHECK64-NEXT: %lane = shufflevector <4 x bfloat> %1, <4 x bfloat> poison, 
<4 x i32> zeroinitializer
 // CHECK64-NEXT: ret <4 x bfloat> %lane
 // CHECK32: %0 = load bfloat, bfloat* %ptr, align 2
 // CHECK32-NEXT: %1 = insertelement <4 x bfloat> undef, bfloat %0, i32 0
-// CHECK32-NEXT: %lane = shufflevector <4 x bfloat> %1, <4 x bfloat> undef, <4 
x i32> zeroinitializer
+// CHECK32-NEXT: %lane = shufflevector <4 x bfloat> %1, <4 x bfloat> poison, 
<4 x i32> zeroinitializer
 // CHECK32-NEXT: ret <4 x bfloat> %lane
 
 bfloat16x4x2_t test_vld1_bf16_x2(bfloat16_t const *ptr) {
@@ -108,11 +108,11 @@ bfloat16x8_t test_vld1q_dup_bf16(bfloat16_t const *ptr) {
 // CHECK-LABEL: test_vld1q_dup_bf16
 // CHECK64: %0 = load bfloat, bfloat* %ptr, align 2
 // CHECK64-NEXT: %1 = insertelement <8 x bfloat> undef, bfloat %0, i32 0
-// CHECK64-NEXT: %lane = shufflevector <8 x bfloat> %1, <8 x bfloat> undef, <8 
x i32> zeroinitializer
+// CHECK64-NEXT: %lane = shufflevector <8 x bfloat> %1, <8 x bfloat> poison, 
<8 x i32> zeroinitializer
 // CHECK64-NEXT: ret <8 x bfloat> %lane
 // CHECK32: %0 = load bfloat, bfloat* %ptr, align 2
 // CHECK32-NEXT: %1 = insertelement <8 x bfloat> undef, bfloat %0, i32 0
-// CHECK32-NEXT: %lane = shufflevector <8 x bfloat> %1, <8 x bfloat> undef, <8 
x i32> zeroinitializer
+// CHECK32-NEXT: %lane = shufflevector <8 x bfloat> %1, <8 x bfloat> poison, 
<8 x i32> zeroinitializer
 // CHECK32-NEXT: ret <8 x bfloat> %lane
 
 bfloat16x4x2_t test_vld2_bf16(bfloat16_t const *ptr) {

diff  --git a/clang/test/CodeGen/aarch64-neon-dot-product.c 
b/clang/test/CodeGen/aarch64-neon-dot-product.c
index 5893553b0d2c9..1cae3e1bc619b 100644
--- a/clang/test/CodeGen/aarch64-neon-dot-product.c
+++ b/clang/test/CodeGen/aarch64-neon-dot-product.c
@@ -38,7 +38,7 @@ int32x4_t test_vdotq_s32(int32x4_t a, int8x16_t b, int8x16_t 
c) {
 uint32x2_t test_vdot_lane_u32(uint32x2_t a, uint8x8_t b, uint8x8_t c) {
 // CHECK-LABEL: define{{.*}} <2 x i32> @test_vdot_lane_u32(<2 x i32> %a, <8 x 
i8> %b, <8 x i8> %c)
 // CHECK: [[CAST1:%.*]] = bitcast <8 x i8> %c to <2 x i32>
-// CHECK: [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[CAST1]], <2 x i32> 
undef, <2 x i32> 
+// CHECK: [[SHUFFLE:%.*]] = shuffleve

[clang] 63fff0f - Fix lit test failures in CodeGenCoroutines

2021-11-06 Thread hyeongyu kim via cfe-commits

Author: hyeongyu kim
Date: 2021-11-06T19:58:34+09:00
New Revision: 63fff0f5bffe20fa2c84a45a41161afa0043cb34

URL: 
https://github.com/llvm/llvm-project/commit/63fff0f5bffe20fa2c84a45a41161afa0043cb34
DIFF: 
https://github.com/llvm/llvm-project/commit/63fff0f5bffe20fa2c84a45a41161afa0043cb34.diff

LOG: Fix lit test failures in CodeGenCoroutines

Added: 


Modified: 
clang/test/CodeGenCoroutines/coro-await.cpp
clang/test/CodeGenCoroutines/coro-ret-void.cpp
clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp

Removed: 




diff  --git a/clang/test/CodeGenCoroutines/coro-await.cpp 
b/clang/test/CodeGenCoroutines/coro-await.cpp
index c16f9a034025..767b3bbaf212 100644
--- a/clang/test/CodeGenCoroutines/coro-await.cpp
+++ b/clang/test/CodeGenCoroutines/coro-await.cpp
@@ -1,8 +1,4 @@
-<<< HEAD
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
-===
-// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu 
-fcoroutines-ts -std=c++14 \
->>> 8ca4b3ef19fe ([Clang/Test]: Rename enable_noundef_analysis to 
disable-noundef-analysis and turn it off by default (2))
+// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu 
-std=c++20 \
 // RUN:   -emit-llvm %s -o - -disable-llvm-passes -Wno-coroutine -Wno-unused | 
FileCheck %s
 
 namespace std {

diff  --git a/clang/test/CodeGenCoroutines/coro-ret-void.cpp 
b/clang/test/CodeGenCoroutines/coro-ret-void.cpp
index 0738790fa845..ea4e28ac98f4 100644
--- a/clang/test/CodeGenCoroutines/coro-ret-void.cpp
+++ b/clang/test/CodeGenCoroutines/coro-ret-void.cpp
@@ -47,10 +47,5 @@ coro2 g() {
 }
 
 // CHECK-LABEL: define{{.*}} void @_Z1gv(
-<<< HEAD
 // CHECK: call void 
@_ZNSt13suspend_never12await_resumeEv(%"struct.std::suspend_never"*
-// CHECK: call void 
@_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* 
{{[^,]*}} %__promise, i32 42)
-===
-// CHECK: call void 
@_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(%"struct.std::experimental::coroutines_v1::suspend_never"*
 // CHECK: call void 
@_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* 
{{[^,]*}} %__promise, i32 noundef 42)
->>> 8ca4b3ef19fe ([Clang/Test]: Rename enable_noundef_analysis to 
disable-noundef-analysis and turn it off by default (2))

diff  --git 
a/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp 
b/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp
index 1b6f8ad2a161..5dd614595424 100644
--- a/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp
+++ b/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 
-O0 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
-// RUN: %clang -fcoroutines-ts -std=c++14 -O0 -emit-llvm -c  %s -o %t -Xclang 
-disable-llvm-passes && %clang -c %t
+// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu 
-fcoroutines-ts -std=c++14 -O0 -emit-llvm %s -o - -disable-llvm-passes | 
FileCheck %s
+// RUN: %clang -disable-noundef-analysis -fcoroutines-ts -std=c++14 -O0 
-emit-llvm -c  %s -o %t -Xclang -disable-llvm-passes && %clang -c %t
 
 #include "Inputs/coroutine-exp-namespace.h"
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8d3b28e - [NFC] Fix lit test failures for clang/CodegenCoroutines

2021-11-08 Thread hyeongyu kim via cfe-commits

Author: hyeongyu kim
Date: 2021-11-09T02:47:16+09:00
New Revision: 8d3b28e7547aac842ed177050ac2a9d25de0f2e9

URL: 
https://github.com/llvm/llvm-project/commit/8d3b28e7547aac842ed177050ac2a9d25de0f2e9
DIFF: 
https://github.com/llvm/llvm-project/commit/8d3b28e7547aac842ed177050ac2a9d25de0f2e9.diff

LOG: [NFC] Fix lit test failures for clang/CodegenCoroutines

Added: 


Modified: 
clang/test/CodeGenCoroutines/coro-await.cpp
clang/test/CodeGenCoroutines/coro-ret-void.cpp

Removed: 




diff  --git a/clang/test/CodeGenCoroutines/coro-await.cpp 
b/clang/test/CodeGenCoroutines/coro-await.cpp
index b2baf0964768..158d55323377 100644
--- a/clang/test/CodeGenCoroutines/coro-await.cpp
+++ b/clang/test/CodeGenCoroutines/coro-await.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu 
-std=c++20 \
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
 // RUN:   -emit-llvm %s -o - -disable-llvm-passes -Wno-coroutine -Wno-unused | 
FileCheck %s
 
 namespace std {

diff  --git a/clang/test/CodeGenCoroutines/coro-ret-void.cpp 
b/clang/test/CodeGenCoroutines/coro-ret-void.cpp
index 16d0c3ca2137..53b200df127b 100644
--- a/clang/test/CodeGenCoroutines/coro-ret-void.cpp
+++ b/clang/test/CodeGenCoroutines/coro-ret-void.cpp
@@ -48,4 +48,4 @@ coro2 g() {
 
 // CHECK-LABEL: define{{.*}} void @_Z1gv(
 // CHECK: call void 
@_ZNSt13suspend_never12await_resumeEv(%"struct.std::suspend_never"*
-// CHECK: call void 
@_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* 
{{[^,]*}} %__promise, i32 noundef 42)
\ No newline at end of file
+// CHECK: call void 
@_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* 
{{[^,]*}} %__promise, i32 42)
\ No newline at end of file



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 4608b1d - Resolve lit failures in clang-aarch64*

2022-01-16 Thread hyeongyu kim via cfe-commits

Author: hyeongyu kim
Date: 2022-01-16T23:06:05+09:00
New Revision: 4608b1d726daa808abf08f0f0860636a7b20771f

URL: 
https://github.com/llvm/llvm-project/commit/4608b1d726daa808abf08f0f0860636a7b20771f
DIFF: 
https://github.com/llvm/llvm-project/commit/4608b1d726daa808abf08f0f0860636a7b20771f.diff

LOG: Resolve lit failures in clang-aarch64*

Added: 


Modified: 
clang/test/Profile/cxx-lambda.cpp

Removed: 




diff  --git a/clang/test/Profile/cxx-lambda.cpp 
b/clang/test/Profile/cxx-lambda.cpp
index 1dda64df915d2..dca076a03c7b1 100644
--- a/clang/test/Profile/cxx-lambda.cpp
+++ b/clang/test/Profile/cxx-lambda.cpp
@@ -19,8 +19,8 @@
 void lambdas() {
   int i = 1;
 
-  // LMBGEN-LABEL: define internal{{( [0-9_a-z]*cc)?( noundef zeroext)?}} i1 
@"_ZZ7lambdasvENK3$_0clEi"(
-  // LMBUSE-LABEL: define internal{{( [0-9_a-z]*cc)?( noundef zeroext)?}} i1 
@"_ZZ7lambdasvENK3$_0clEi"(
+  // LMBGEN-LABEL: define internal{{( [0-9_a-z]*cc)?( noundef)?( zeroext)?}} 
i1 @"_ZZ7lambdasvENK3$_0clEi"(
+  // LMBUSE-LABEL: define internal{{( [0-9_a-z]*cc)?( noundef)?( zeroext)?}} 
i1 @"_ZZ7lambdasvENK3$_0clEi"(
   // LMBGEN: store {{.*}} @[[LFC]], i32 0, i32 0
   auto f = [&i](int k) {
 // LMBGEN: store {{.*}} @[[LFC]], i32 0, i32 1



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 80dba72 - [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default

2021-10-15 Thread hyeongyu kim via cfe-commits

Author: Juneyoung Lee
Date: 2021-10-16T12:01:37+09:00
New Revision: 80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a

URL: 
https://github.com/llvm/llvm-project/commit/80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a
DIFF: 
https://github.com/llvm/llvm-project/commit/80dba72a669b5416e97a42fd2c2a7bc5a6d3f44a.diff

LOG: [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis 
and turn it off by default

Turning on `enable_noundef_analysis` flag allows better codegen by removing 
freeze instructions.
I modified clang by renaming `enable_noundef_analysis` flag to 
`disable-noundef-analysis` and turning it off by default.

Test updates are made as a separate patch: D108453

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D105169

Added: 


Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGCall.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 6101232601755..520487325d6e0 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -64,7 +64,7 @@ CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any 
lifetime markers
 CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with 
optnone at O0
 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(DisableNoundefAttrs, 1, 0) ///< Disable 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.

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 4d422abd03a0e..ab7571f0bde4b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5314,9 +5314,9 @@ def disable_free : Flag<["-"], "disable-free">,
 def clear_ast_before_backend : Flag<["-"], "clear-ast-before-backend">,
   HelpText<"Clear the Clang AST before running backend code generation">,
   MarshallingInfoFlag>;
-def enable_noundef_analysis : Flag<["-"], "enable-noundef-analysis">, 
Group,
-  HelpText<"Enable analyzing function argument and return types for mandatory 
definedness">,
-  MarshallingInfoFlag>;
+def disable_noundef_analysis : Flag<["-"], "disable-noundef-analysis">, 
Group,
+  HelpText<"Disable analyzing function argument and return types for mandatory 
definedness">,
+  MarshallingInfoFlag>;
 def discard_value_names : Flag<["-"], "discard-value-names">,
   HelpText<"Discard value names in LLVM IR">,
   MarshallingInfoFlag>;

diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index daea09be3e70b..c3b87398c4971 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2255,7 +2255,7 @@ void CodeGenModule::ConstructAttributeList(
  getLangOpts().Sanitize.has(SanitizerKind::Return);
 
   // Determine if the return type could be partially undef
-  if (CodeGenOpts.EnableNoundefAttrs && HasStrictReturn) {
+  if (!CodeGenOpts.DisableNoundefAttrs && HasStrictReturn) {
 if (!RetTy->isVoidType() && RetAI.getKind() != ABIArgInfo::Indirect &&
 DetermineNoUndef(RetTy, getTypes(), DL, RetAI))
   RetAttrs.addAttribute(llvm::Attribute::NoUndef);
@@ -2390,7 +2390,7 @@ void CodeGenModule::ConstructAttributeList(
 
 // Decide whether the argument we're handling could be partially undef
 bool ArgNoUndef = DetermineNoUndef(ParamType, getTypes(), DL, AI);
-if (CodeGenOpts.EnableNoundefAttrs && ArgNoUndef)
+if (!CodeGenOpts.DisableNoundefAttrs && ArgNoUndef)
   Attrs.addAttribute(llvm::Attribute::NoUndef);
 
 // 'restrict' -> 'noalias' is done in EmitFunctionProlog when we



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits