diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-11-01 08:56:51 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-11-01 08:56:51 +0000 |
commit | 1bb9aea56bdbac6fa8cb28d18a0b6c9879bee12b (patch) | |
tree | 5d804dd3b4d10371bed6348c033b8b92706d7f74 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 9d5b2d4adc6d3ba29628d23173d4b078ba42d5fd (diff) | |
download | bcm5719-llvm-1bb9aea56bdbac6fa8cb28d18a0b6c9879bee12b.tar.gz bcm5719-llvm-1bb9aea56bdbac6fa8cb28d18a0b6c9879bee12b.zip |
[clang][CodeGen] ImplicitIntegerSignChangeSanitizer: actually ignore NOP casts.
I fully expected for that to be handled by the canonical type check,
but it clearly wasn't. Sadly, somehow it hide until now.
Reported by Eli Friedman.
llvm-svn: 345816
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index ef2999a24da..0b9a0a45c57 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1127,10 +1127,9 @@ void ScalarExprEmitter::EmitIntegerSignChangeCheck(Value *Src, QualType SrcType, // Now, we do not need to emit the check in *all* of the cases. // We can avoid emitting it in some obvious cases where it would have been // dropped by the opt passes (instcombine) always anyways. - // If it's a cast between the same type, just differently-sugared. no check. - QualType CanonSrcType = CGF.getContext().getCanonicalType(SrcType); - QualType CanonDstType = CGF.getContext().getCanonicalType(DstType); - if (CanonSrcType == CanonDstType) + // If it's a cast between effectively the same type, no check. + // NOTE: this is *not* equivalent to checking the canonical types. + if (SrcSigned == DstSigned && SrcBits == DstBits) return; // At least one of the values needs to have signed type. // If both are unsigned, then obviously, neither of them can be negative. |