[FPEnv] Fix chain handling regression after 04a8696
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 14 Jan 2020 13:04:53 +0000 (14:04 +0100)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 14 Jan 2020 13:10:57 +0000 (14:10 +0100)
commit81ee484484a0be59da8f749a9b4cf56bb8d37402
tree3077a1a8f617e560e41a0dc867070a4ecd31dac3
parentdf186507e1d07c3ddba091a076ba7a33dbdc5867
[FPEnv] Fix chain handling regression after 04a8696

Code in getRoot made the assumption that every node in PendingLoads
must always itself have a dependency on the current DAG root node.

After the changes in 04a8696, it turns out that this assumption no
longer holds true, causing wrong codegen in some cases (e.g. stores
after constrained FP intrinsics might get deleted).

To fix this, we now need to make sure that the TokenFactor created
by getRoot always includes the previous root, if there is no implicit
dependency already present.

The original getControlRoot code already has exactly this check,
so this patch simply reuses that code now for getRoot as well.
This fixes the regression.

NFC if no constrained FP intrinsic is present.
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/test/CodeGen/SystemZ/fp-strict-alias.ll