This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Double check for constant expression domination
AbandonedPublic

Authored by sdmitrouk on Sep 23 2014, 1:35 AM.

Details

Reviewers
resistor
Summary

isSafeToSpeculativelyExecute() function contains more sophisticated checks
than Constant::canTrap(), so it appears to me that both functions should be
called to prevent optimizations that can harm.

I wasn't able to make a test, but absence of this check does cause trouble
with my local changes that disable certain kinds of optimizations to provide
IEEE754 conformant raising of FP exceptions, which I'd like to contribute.

Diff Detail

Event Timeline

sdmitrouk updated this revision to Diff 13976.Sep 23 2014, 1:35 AM
sdmitrouk retitled this revision from to [SimplifyCFG] Double check for constant expression domination.
sdmitrouk updated this object.
sdmitrouk edited the test plan for this revision. (Show Details)
sdmitrouk added a reviewer: resistor.
sdmitrouk set the repository for this revision to rL LLVM.
sdmitrouk added a subscriber: Unknown Object (MLST).

This does not seem like the right fix. What is isSafeToSpeculativelyExecute checking that C->canTrap is not checking? I'd think that fixing C->canTrap is the right way to address this problem.

hfinkel@anl.gov wrote:

This does not seem like the right fix. What is isSafeToSpeculativelyExecute checking that C->canTrap is not checking? I'd think that fixing C->canTrap is the right way to address this problem.

I'd also like to make a plea for a testcase here. If we had a testcase,
we could see for ourselves what isSafeToSpeculativelyExecute is checking
that c->canTrap isn't.

http://reviews.llvm.org/D5459


llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

sdmitrouk abandoned this revision.Oct 3 2014, 10:09 AM

Sorry for the delay.

This does not seem like the right fix. What is isSafeToSpeculativelyExecute checking that C->canTrap is not checking?

Looks like I misread the code of canTrap.

I'd think that fixing C->canTrap is the right way to address this problem.

It's not broken at the moment. It didn't work the way I'd expect after I modified isSafeToSpeculativelyExecute. If I get it right this time, I need to duplicate checks in isSafeToSpeculativelyExecute and canTrap, because the former one doesn't call the later one.

I'd also like to make a plea for a testcase here. If we had a testcase,
we could see for ourselves what isSafeToSpeculativelyExecute is checking
that c->canTrap isn't.

It works fine while these two functions are in sync, I missed that it's important to update both of them at the same time.

Thanks, now I understand that new checks should be introduced in a different way.