diff options
author | elhewaty <mohamedatef1698@gmail.com> | 2024-10-15 12:11:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 17:11:25 +0800 |
commit | 9efb07f261b2cd673c0a5abf2ed2546ad288ab48 (patch) | |
tree | 1aaa512bdb656ee9f9c665634fc39c94410bfa38 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 48521209aa4d95a97564f8a5af7ccca09c6ede5d (diff) | |
download | llvm-9efb07f261b2cd673c0a5abf2ed2546ad288ab48.zip llvm-9efb07f261b2cd673c0a5abf2ed2546ad288ab48.tar.gz llvm-9efb07f261b2cd673c0a5abf2ed2546ad288ab48.tar.bz2 |
[IR] Add `samesign` flag to icmp instruction (#111419)
Inspired by
https://discourse.llvm.org/t/rfc-signedness-independent-icmps/81423
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index c3bd107..d900214 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1718,6 +1718,9 @@ static uint64_t getOptimizationFlags(const Value *V) { Flags |= 1 << bitc::GEP_NUSW; if (GEP->hasNoUnsignedWrap()) Flags |= 1 << bitc::GEP_NUW; + } else if (const auto *ICmp = dyn_cast<ICmpInst>(V)) { + if (ICmp->hasSameSign()) + Flags |= 1 << bitc::ICMP_SAME_SIGN; } return Flags; |