StgCse: Do not re-use trivial case scrutinees
authorJoachim Breitner <mail@joachim-breitner.de>
Sun, 9 Apr 2017 23:40:02 +0000 (19:40 -0400)
committerJoachim Breitner <mail@joachim-breitner.de>
Mon, 10 Apr 2017 14:12:39 +0000 (10:12 -0400)
commitb55f310d06b8d3988d40aaccc0ff13601ee52b84
treef032490d14cb2c4a03f3a9b97456c16b1df5cd7c
parent87377f74eec1567af741737b4b9034d06e3f0698
StgCse: Do not re-use trivial case scrutinees

as they might be marked as one-shot, and suddenly we’d evaluate them
multiple times. This came up in #13536 (test cases included).

The solution was layed out by SPJ in ticket:13536#comment:12.

Differential Revision: https://phabricator.haskell.org/D3437
compiler/simplStg/StgCse.hs
testsuite/tests/simplStg/should_run/T13536.hs [new file with mode: 0644]
testsuite/tests/simplStg/should_run/T13536.stderr [new file with mode: 0644]
testsuite/tests/simplStg/should_run/T13536.stdout [new file with mode: 0644]
testsuite/tests/simplStg/should_run/all.T