1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

[ValueTracking] Instruction::isBinaryOp should be used for constexprs

This is a simple patch that makes canCreateUndefOrPoison use
Instruction::isBinaryOp because BinaryOperator inherits Instruction.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D84596
This commit is contained in:
Juneyoung Lee 2020-07-26 21:48:51 +09:00
parent e0da85891c
commit e7db975cc1
2 changed files with 2 additions and 3 deletions

View File

@ -4773,7 +4773,7 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly) {
const auto *CE = dyn_cast<ConstantExpr>(Op);
if (isa<CastInst>(Op) || (CE && CE->isCast()))
return false;
else if (isa<BinaryOperator>(Op))
else if (Instruction::isBinaryOp(Opcode))
return false;
// Be conservative and return true.
return true;

View File

@ -139,8 +139,7 @@ define i32* @constant_expr3() {
define i64 @ptrdiff() {
; CHECK-LABEL: @ptrdiff(
; CHECK-NEXT: [[R:%.*]] = freeze i64 sub (i64 ptrtoint (i16* @g to i64), i64 ptrtoint (i16* @g2 to i64))
; CHECK-NEXT: ret i64 [[R]]
; CHECK-NEXT: ret i64 sub (i64 ptrtoint (i16* @g to i64), i64 ptrtoint (i16* @g2 to i64))
;
%i = ptrtoint i16* @g to i64
%i2 = ptrtoint i16* @g2 to i64