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

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 26 05:49:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f074214b7a3: [ValueTracking] Instruction::isBinaryOp should be used for constexprs (authored by aqjune).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84596/new/

https://reviews.llvm.org/D84596

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Transforms/InstSimplify/freeze.ll


Index: llvm/test/Transforms/InstSimplify/freeze.ll
===================================================================
--- llvm/test/Transforms/InstSimplify/freeze.ll
+++ llvm/test/Transforms/InstSimplify/freeze.ll
@@ -139,8 +139,7 @@
 
 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
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -4773,7 +4773,7 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84596.280720.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200726/269f9bd1/attachment.bin>


More information about the llvm-commits mailing list