Debian Codegraph @

external/llvm/releases/15.0.0/patches_external/Don-t-emit-bitreverse-or-bswap-intrinsics-of-illegal.patch

raw
1 From 881bf715f06201a57a4f1a60155b556fedd556db Mon Sep 17 00:00:00 2001
2 From: Victor Mustya <[email protected]>
3 Date: Tue, 22 Aug 2023 11:10:30 -0700
4 Subject: [PATCH] Don't emit bitreverse or bswap intrinsics of illegal bit
5 width during instcombine
6
7 ---
8 llvm/lib/Transforms/Utils/Local.cpp | 4 ++++
9 1 file changed, 4 insertions(+)
10
11 diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
12 index 2f1d0c2f9..68f792bb0 100644
13 --- a/llvm/lib/Transforms/Utils/Local.cpp
14 +++ b/llvm/lib/Transforms/Utils/Local.cpp
15 @@ -3196,6 +3196,10 @@ bool llvm::recognizeBSwapOrBitReverseIdiom(
16 if (DemandedBW > ITy->getScalarSizeInBits())
17 return false;
18
19 + auto &DL = I->getModule()->getDataLayout();
20 + if (DL.isIllegalInteger(DemandedBW))
21 + return false;
22 +
23 // Now, is the bit permutation correct for a bswap or a bitreverse? We can
24 // only byteswap values with an even number of bytes.
25 APInt DemandedMask = APInt::getAllOnes(DemandedBW);
26 --
27 2.34.1
28