aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/Interp/IntegralAP.h
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2023-11-17 11:46:52 +0000
committerFlorian Hahn <flo@fhahn.com>2023-11-17 11:46:52 +0000
commit77c2f330a9fc2f332388e777f396451a5d4a6bc8 (patch)
tree51c91ad2fd7d215ca0f55250070f8e24b48c907f /clang/lib/AST/Interp/IntegralAP.h
parent05bd5ecad3cbd218fca59dfcd71be2e5294a08ed (diff)
parentec42d547eba5c0ad0bddbecc8902d35383968e78 (diff)
downloadllvm-users/fhahn/main.passes-disable-code-sinking-in-instcombine-early-on.zip
llvm-users/fhahn/main.passes-disable-code-sinking-in-instcombine-early-on.tar.gz
llvm-users/fhahn/main.passes-disable-code-sinking-in-instcombine-early-on.tar.bz2
[𝘀𝗽𝗿] changes introduced through rebaseusers/fhahn/main.passes-disable-code-sinking-in-instcombine-early-on
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'clang/lib/AST/Interp/IntegralAP.h')
-rw-r--r--clang/lib/AST/Interp/IntegralAP.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/Interp/IntegralAP.h
index bd665959c..9019f32 100644
--- a/clang/lib/AST/Interp/IntegralAP.h
+++ b/clang/lib/AST/Interp/IntegralAP.h
@@ -102,7 +102,12 @@ public:
template <bool InputSigned>
static IntegralAP from(IntegralAP<InputSigned> V, unsigned NumBits = 0) {
- return IntegralAP<Signed>(V.V);
+ if (NumBits == 0)
+ NumBits = V.bitWidth();
+
+ if constexpr (InputSigned)
+ return IntegralAP<Signed>(V.V.sextOrTrunc(NumBits));
+ return IntegralAP<Signed>(V.V.zextOrTrunc(NumBits));
}
template <unsigned Bits, bool InputSigned>