[PATCH] D155711: [SimplifyCFG] Hoist common instructions on Switch.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 12:55:30 PDT 2023
MaskRay added a comment.
In D155711#4648971 <https://reviews.llvm.org/D155711#4648971>, @MaskRay wrote:
> In D155711#4648928 <https://reviews.llvm.org/D155711#4648928>, @MaskRay wrote:
>
>> Early heads-up we internally have identified a crash due to this change.
>
> I will try giving a reproduce later, but am reverting this now.
>
> musttail call must precede a ret with an optional bitcast
% cat x.ll
source_filename = "<stdin>"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define ptr @ham(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, ptr %arg4, i64 %arg5) {
bb:
%load = load i16, ptr %arg, align 2
%and = and i16 %load, 1
%icmp = icmp eq i16 %and, 0
br i1 %icmp, label %bb7, label %bb6
bb6: ; preds = %bb
ret ptr null
bb7: ; preds = %bb
switch i16 %load, label %bb13 [
i16 0, label %bb8
i16 1, label %bb9
i16 2, label %bb11
]
bb8: ; preds = %bb7
%call = musttail call ptr @zot(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, ptr %arg4, i64 %arg5)
ret ptr %call
bb9: ; preds = %bb7
%call10 = musttail call ptr @zot(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, ptr %arg4, i64 %arg5)
ret ptr %call10
bb11: ; preds = %bb7
%call12 = musttail call ptr @zot(ptr %arg, ptr %arg1, ptr %arg2, i64 %arg3, ptr %arg4, i64 %arg5)
ret ptr %call12
bb13: ; preds = %bb7
unreachable
}
declare ptr @zot(ptr, ptr, ptr, i64, ptr, i64)
% opt -O2 -S < x.ll
musttail call must precede a ret with an optional bitcast
%call = musttail call ptr @zot(ptr nonnull %arg, ptr %arg1, ptr %arg2, i64 %arg3, ptr %arg4, i64 %arg5)
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155711/new/
https://reviews.llvm.org/D155711
More information about the llvm-commits
mailing list