]> granicus.if.org Git - llvm/commit
[InstSimplify][ConstantFolding] Teach constant folding how to handle icmp null, ...
authorCraig Topper <craig.topper@gmail.com>
Fri, 2 Jun 2017 16:17:32 +0000 (16:17 +0000)
committerCraig Topper <craig.topper@gmail.com>
Fri, 2 Jun 2017 16:17:32 +0000 (16:17 +0000)
commitcbb8bc969e8a41571b344cb1dd73d2c47816f925
tree94c65f5015dd3723ca92c9526855a703099af4a0
parent17c16d5b4241c69614bef2cec1ff943453608261
[InstSimplify][ConstantFolding] Teach constant folding how to handle icmp null, (inttoptr x) as well as it handles icmp (inttoptr x), null

Summary:
The constant folding code currently assumes that the constant expression will always be on the left and the simple null will be on the right. But that's not true at least on the path from InstSimplify.

This patch adds support to ConstantFolding to detect the reversed case.

Reviewers: spatel, dberlin, majnemer, davide, joey

Reviewed By: joey

Subscribers: joey, llvm-commits

Differential Revision: https://reviews.llvm.org/D33801

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304559 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
test/Transforms/InstSimplify/compare.ll