Vojislav Tomasevic
2a77d92e2e
[clang] Incorrect IR involving the use of bcopy ( #79298 )
...
This patch addresses the issue regarding the call of bcopy function in a
conditional expression.
It is analogous to the already accepted patch which deals with the same
problem, just regarding the bzero function [0].
Here is the testcase which illustrates the issue:
```
void bcopy(const void *, void *, unsigned long);
void foo(void);
void test_bcopy() {
char dst[20];
char src[20];
int _sz = 20, len = 20;
return (_sz
? ((_sz >= len)
? bcopy(src, dst, len)
: foo())
: bcopy(src, dst, len));
}
```
When processing it with clang, following issue occurs:
Instruction does not dominate all uses!
%arraydecay2 = getelementptr inbounds [20 x i8], ptr %dst, i64 0, i64 0,
!dbg !38
%cond = phi ptr [ %arraydecay2, %cond.end ], [ %arraydecay5,
%cond.false3 ], !dbg !33
fatal error: error in backend: Broken module found, compilation aborted!
This happens because an incorrect phi node is created. It is created
because bcopy function call is lowered to the call of llvm.memmove
intrinsic and function memmove returns void *. Since llvm.memmove is
called in two places in the same return statement, clang creates a phi
node in the final basic block for the return value and that phi node is
incorrect. However, bcopy function should return void in the first
place, so this phi node is unnecessary. This is what this patch
addresses. An appropriate test is also added and no existing tests fail
when applying this patch.
Also, this crash only happens when LLVM is configured with
-DLLVM_ENABLE_ASSERTIONS=On option.
[0] https://reviews.llvm.org/D39746
2024-01-24 09:39:36 -08:00
..
2023-11-02 17:00:33 -07:00
2024-01-23 17:41:12 +01:00
2024-01-22 17:12:16 +00:00
2024-01-05 09:55:50 +00:00
2024-01-23 17:21:52 +00:00
2024-01-18 09:51:34 +00:00
2024-01-11 09:46:54 +01:00
2023-06-13 12:43:46 +01:00
2024-01-04 15:51:57 +08:00
2024-01-11 09:46:54 +01:00
2023-05-19 08:44:12 -04:00
2024-01-24 13:19:19 +08:00
2024-01-24 15:25:29 +01:00
2024-01-18 21:47:06 +07:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-16 23:57:42 -08:00
2024-01-11 09:46:54 +01:00
2023-08-09 18:33:11 -04:00
2024-01-11 09:46:54 +01:00
2023-08-14 11:28:41 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-11 08:42:01 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-11-25 00:11:20 +01:00
2023-11-25 00:11:20 +01:00
2023-08-21 12:25:15 +01:00
2023-07-26 17:33:06 +01:00
2023-07-26 17:33:06 +01:00
2023-12-19 11:53:18 +01:00
2023-12-19 11:53:18 +01:00
2023-06-29 09:06:00 +01:00
2023-06-27 19:21:41 -07:00
2023-06-27 19:21:41 -07:00
2024-01-11 12:53:23 +00:00
2024-01-08 20:46:05 -08:00
2023-11-03 15:34:45 +00:00
2024-01-24 15:25:29 +01:00
2023-10-03 16:12:19 -05:00
2023-06-27 20:02:52 -07:00
2023-12-19 11:53:18 +01:00
2023-12-19 11:53:18 +01:00
2023-12-19 11:53:18 +01:00
2023-07-07 12:31:55 +01:00
2023-07-26 17:33:06 +01:00
2023-08-30 12:39:04 +02:00
2023-07-26 17:33:06 +01:00
2023-12-18 16:12:37 +01:00
2023-12-19 11:53:18 +01:00
2023-06-23 11:54:29 +01:00
2023-07-11 21:34:53 +07:00
2024-01-11 09:46:54 +01:00
2023-08-11 14:48:19 +00:00
2023-07-25 08:55:45 +00:00
2023-10-24 14:02:51 +01:00
2024-01-15 10:56:37 -05:00
2023-12-19 11:53:18 +01:00
2023-12-19 11:53:18 +01:00
2023-09-11 12:59:18 +01:00
2024-01-11 09:46:54 +01:00
2023-09-27 21:29:56 -07:00
2023-10-04 15:16:00 +02:00
2024-01-11 09:46:54 +01:00
2023-06-30 09:07:23 -04:00
2023-08-31 11:43:47 -04:00
2024-01-11 09:46:54 +01:00
2023-08-28 12:13:42 -04:00
2024-01-23 11:13:55 -08:00
2023-11-09 10:34:35 +05:30
2024-01-23 17:08:18 +05:30
2023-11-29 15:13:30 -08:00
2023-11-29 15:13:30 -08:00
2023-11-29 15:13:30 -08:00
2023-11-29 15:13:30 -08:00
2023-06-08 17:41:27 +02:00
2023-11-01 23:50:35 -05:00
2024-01-11 09:46:54 +01:00
2023-12-19 11:53:18 +01:00
2023-07-26 17:33:06 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-10-13 13:34:15 -07:00
2023-09-14 11:00:49 +01:00
2023-12-19 11:53:18 +01:00
2024-01-11 09:46:54 +01:00
2024-01-23 14:39:15 +00:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-06-27 19:21:41 -07:00
2023-12-19 11:53:18 +01:00
2023-12-19 11:53:18 +01:00
2023-12-31 20:44:48 +08:00
2024-01-11 09:46:54 +01:00
2023-06-27 19:21:41 -07:00
2023-12-19 11:53:18 +01:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-12-08 15:04:08 +00:00
2023-12-19 11:53:18 +01:00
2024-01-11 09:46:54 +01:00
2023-12-31 20:44:48 +08:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-07-11 15:13:57 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-12-04 13:37:04 -05:00
2023-08-28 12:13:42 -04:00
2024-01-24 15:25:29 +01:00
2023-07-18 10:04:33 -07:00
2023-06-13 00:53:31 -05:00
2023-06-12 18:38:47 +02:00
2023-07-22 09:34:15 -07:00
2023-07-22 09:34:15 -07:00
2023-08-28 12:13:42 -04:00
2024-01-24 15:25:29 +01:00
2023-07-05 17:32:00 +08:00
2023-10-19 15:11:15 +08:00
2023-12-14 14:57:00 -07:00
2023-08-15 14:49:02 -07:00
2023-12-14 14:52:35 -07:00
2023-12-14 14:52:35 -07:00
2023-06-27 01:15:45 +03:00
2024-01-11 09:46:54 +01:00
2024-01-24 15:25:29 +01:00
2023-07-18 10:04:33 -07:00
2023-10-26 12:20:01 -07:00
2023-08-02 01:21:14 +08:00
2023-12-28 18:15:12 -08:00
2023-06-16 16:41:15 -07:00
2024-01-22 19:55:16 +01:00
2023-12-14 14:57:00 -07:00
2023-12-14 14:57:00 -07:00
2023-12-14 14:57:00 -07:00
2023-12-14 14:57:00 -07:00
2024-01-23 15:48:12 +00:00
2023-10-19 07:52:50 +08:00
2023-06-30 13:19:15 +08:00
2023-08-28 12:13:42 -04:00
2023-10-05 13:17:47 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-16 14:26:12 -08:00
2023-12-05 19:21:42 +02:00
2023-12-05 19:21:42 +02:00
2023-12-05 19:21:42 +02:00
2023-12-05 19:21:42 +02:00
2023-12-05 19:21:42 +02:00
2023-09-14 10:24:26 +01:00
2023-07-11 21:34:53 +07:00
2023-07-11 21:34:53 +07:00
2023-10-19 13:40:41 +02:00
2023-09-27 21:29:56 -07:00
2023-11-07 00:31:04 -06:00
2023-11-07 00:31:04 -06:00
2023-08-28 12:13:42 -04:00
2023-08-02 15:32:37 -07:00
2023-08-25 20:56:25 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-11 19:32:39 -04:00
2023-06-20 11:38:37 +01:00
2023-05-23 08:29:52 +02:00
2023-06-28 11:57:13 -07:00
2023-08-28 12:13:42 -04:00
2024-01-24 09:39:36 -08:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-24 11:22:43 +01:00
2023-08-28 12:13:42 -04:00
2023-06-12 17:39:44 -04:00
2023-06-12 17:39:44 -04:00
2023-10-04 15:16:00 +02:00
2023-11-12 22:26:27 -08:00
2023-08-17 16:33:46 +09:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-03 13:58:33 +08:00
2024-01-24 15:25:29 +01:00
2023-11-20 16:09:42 -06:00
2023-08-24 22:31:11 -07:00
2023-10-03 18:05:54 +02:00
2023-06-29 09:06:00 +01:00
2023-08-28 12:13:42 -04:00
2023-12-11 10:03:27 -05:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-10-30 11:15:36 -07:00
2023-10-02 12:40:20 +02:00
2023-09-09 23:14:12 +03:00
2023-11-17 16:55:18 -06:00
2024-01-22 15:50:24 -05:00
2023-08-28 12:13:42 -04:00
2023-05-09 09:49:42 +02:00
2024-01-16 17:01:01 -08:00
2023-08-28 12:13:42 -04:00
2023-07-06 12:59:05 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-06-14 15:28:33 -07:00
2023-10-23 22:22:00 +04:00
2023-12-12 10:13:42 -08:00
2023-08-28 12:13:42 -04:00
2023-05-19 08:44:12 -04:00
2024-01-16 17:01:01 -08:00
2024-01-16 17:01:01 -08:00
2023-08-28 12:13:42 -04:00
2024-01-12 16:08:52 +00:00
2023-05-02 11:56:23 -04:00
2023-08-28 12:13:42 -04:00
2023-04-29 08:44:59 -04:00
2023-04-29 08:44:59 -04:00
2023-08-28 12:13:42 -04:00
2023-06-08 17:41:27 +02:00
2023-05-24 20:16:42 +01:00
2023-06-08 17:41:27 +02:00
2023-08-28 12:13:42 -04:00
2023-09-01 22:39:38 +03:00
2023-09-04 03:05:51 -04:00
2023-08-01 21:55:36 +01:00
2023-07-11 15:13:57 -07:00
2023-08-21 17:07:38 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2023-05-02 08:23:22 -04:00
2023-08-28 12:13:42 -04:00
2024-01-23 14:04:52 -08:00
2023-09-05 14:22:55 -04:00
2023-08-11 15:59:52 -04:00
2024-01-09 09:18:07 +01:00
2023-10-03 16:12:19 -05:00
2023-10-03 16:12:19 -05:00
2023-10-03 16:12:19 -05:00
2023-11-11 09:43:03 +01:00
2023-11-28 23:38:50 +09:00
2023-07-13 11:49:00 +07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-20 12:37:35 -05:00
2023-08-28 12:13:42 -04:00
2023-08-25 13:54:50 -07:00
2022-02-15 16:06:43 -05:00
2023-08-28 12:13:42 -04:00
2024-01-24 15:25:29 +01:00
2023-07-10 14:14:16 +01:00
2023-12-31 20:44:48 +08:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-05-29 10:02:18 +02:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-12-18 09:46:58 -08:00
2024-01-11 09:46:54 +01:00
2023-07-07 16:50:30 +00:00
2023-07-15 16:13:48 -04:00
2024-01-11 09:46:54 +01:00
2024-01-12 12:23:42 -08:00
2023-08-28 12:13:42 -04:00
2023-06-09 11:28:14 -07:00
2023-06-20 08:02:58 -05:00
2023-09-20 13:37:13 +02:00
2023-10-03 18:05:54 +02:00
2023-12-15 17:23:16 -05:00
2023-09-08 17:56:51 -04:00
2023-09-19 09:13:02 -04:00
2023-09-08 10:54:35 -07:00
2024-01-11 09:46:54 +01:00
2023-05-30 10:58:06 -07:00
2023-05-31 21:13:07 +02:00
2023-07-11 13:16:20 -07:00
2024-01-22 11:55:39 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-05-04 09:42:25 -07:00
2023-10-15 16:13:43 -07:00
2024-01-11 09:46:54 +01:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-05-04 09:42:25 -07:00
2023-08-29 11:43:57 +02:00
2023-11-27 07:27:50 -08:00
2023-05-09 00:07:40 +08:00
2023-06-08 22:41:00 +08:00
2023-08-28 12:13:42 -04:00
2023-08-14 11:33:33 +01:00
2023-12-04 13:37:04 -05:00
2024-01-24 15:25:29 +01:00
2023-12-31 20:44:48 +08:00
2023-06-13 00:53:31 -05:00
2023-08-15 14:49:02 -07:00
2023-11-11 09:43:03 +01:00
2023-08-28 12:13:42 -04:00
2024-01-24 15:25:29 +01:00
2023-08-28 12:13:42 -04:00
2023-12-17 18:22:44 -08:00
2023-05-03 16:05:27 -04:00
2023-05-23 14:41:46 -07:00
2023-08-28 12:13:42 -04:00
2024-01-18 10:53:54 -08:00
2023-08-28 12:13:42 -04:00
2023-12-10 18:03:08 -08:00
2023-06-10 10:40:43 -07:00
2023-08-28 12:13:42 -04:00
2023-09-25 17:53:39 +08:00
2023-07-11 11:52:07 -04:00
2023-12-11 10:03:27 -05:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-20 12:37:35 -05:00
2023-09-13 08:57:10 -07:00
2023-08-28 12:13:42 -04:00
2023-08-07 13:17:26 -07:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2023-08-03 13:58:33 +08:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-08-29 11:35:14 +08:00
2023-08-29 11:35:14 +08:00
2023-08-29 11:35:14 +08:00
2023-08-29 11:35:14 +08:00
2023-04-28 15:41:17 -07:00
2023-08-28 12:13:42 -04:00
2023-12-07 13:40:25 -06:00
2024-01-22 15:50:24 -05:00
2024-01-11 09:46:54 +01:00
2023-07-21 20:05:35 -07:00
2023-07-11 16:25:07 -07:00
2024-01-11 09:46:54 +01:00
2023-11-30 11:18:02 +00:00
2023-10-23 18:26:08 -07:00
2023-07-11 21:34:53 +07:00
2023-08-11 19:32:39 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-11-10 15:21:05 +08:00
2024-01-18 09:22:04 +08:00
2023-12-15 15:49:25 +01:00
2023-10-05 10:33:44 +00:00
2023-12-08 12:58:39 +00:00
2023-07-19 17:37:15 +00:00
2024-01-12 16:08:52 +00:00
2023-05-10 14:58:35 -07:00
2023-07-19 17:37:15 +00:00
2023-10-25 07:51:28 -04:00
2023-08-28 12:13:42 -04:00
2023-08-15 10:10:03 -04:00
2023-06-30 13:19:15 +08:00
2023-06-02 13:01:05 -07:00
2023-08-16 15:09:14 -07:00
2023-10-02 19:09:39 +02:00
2023-05-22 10:11:30 -07:00
2023-09-21 02:56:57 +02:00
2023-09-07 09:49:27 -04:00
2023-08-28 12:13:42 -04:00
2024-01-24 15:25:29 +01:00
2023-08-14 08:59:59 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-01-11 09:46:54 +01:00
2023-06-22 08:51:29 -07:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-09-23 19:40:24 +05:30
2023-08-10 21:54:32 -07:00
2023-05-17 14:42:39 -07:00
2023-11-07 20:43:40 -08:00
2024-01-11 09:46:54 +01:00
2024-01-11 09:46:54 +01:00
2023-06-19 20:38:16 -07:00
2023-06-19 20:28:39 -07:00
2023-06-19 20:38:16 -07:00
2023-06-20 22:40:56 -07:00
2023-06-19 20:38:16 -07:00
2023-06-19 20:28:39 -07:00