summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTCommon.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-12-20 10:52:44 -0800
committerCraig Topper <craig.topper@intel.com>2019-12-20 11:24:45 -0800
commitde2378b4f3c4c88eae412a30a8bfaec82f54d1b7 (patch)
tree7e45bd78bb5c72b123f8f371d540dce85e74b2ea /clang/lib/Serialization/ASTCommon.cpp
parent2861324208e13846eb306f01b32448f94177cc3b (diff)
downloadbcm5719-llvm-de2378b4f3c4c88eae412a30a8bfaec82f54d1b7.tar.gz
bcm5719-llvm-de2378b4f3c4c88eae412a30a8bfaec82f54d1b7.zip
[X86] Fix a KNL miscompile caused by combineSetCC swapping LHS/RHS variables before a later use.
The setcc operands are copied into LHS and RHS variables at the top of the function. We also capture the condition code. A later piece of code swaps the operands and changing the CC variable as part of a canonicalization to make some other checks simpler. But we might not make the transform we canonicalized for. So we continue on through the function where we can use the swapped LHS/RHS variables and access the original condition code operand instead of the modified CC variable. This leads to a setcc being created with the original condition code, but with swapped operands. To mitigate this, this patch does a couple things. The LHS/RHS/CC variables are made const to keep them from being modified like this again. The transform that needs the swap now uses temporary copies of the variables. And the transform that used the original condition code operand has been altered to use the CC variable we cached originally. Either of these changes are enough to fix the issue, but doing both to make this code very safe. I also considered rewriting the swap code in some way to check both permutations without explicitly swapping or needing temporary variables, but held off on that. Differential Revision: https://reviews.llvm.org/D71736
Diffstat (limited to 'clang/lib/Serialization/ASTCommon.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud