Skip to content

Commit fb338c3

Browse files
committed
!fixup address comments, thanks
1 parent d5fb1db commit fb338c3

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,12 +1262,12 @@ Constant *llvm::ConstantFoldCompareInstOperands(
12621262
Value *Stripped0 = Ops0->stripAndAccumulateConstantOffsets(
12631263
DL, Offset0, /*AllowNonInbounds=*/IsEqPred,
12641264
/*AllowInvariantGroup=*/false, /*ExternalAnalysis=*/nullptr,
1265-
/*LookThroughIntToPtr*/ IsEqPred);
1265+
/*LookThroughIntToPtr=*/IsEqPred);
12661266
APInt Offset1(IndexWidth, 0);
12671267
Value *Stripped1 = Ops1->stripAndAccumulateConstantOffsets(
12681268
DL, Offset1, /*AllowNonInbounds=*/IsEqPred,
12691269
/*AllowInvariantGroup=*/false, /*ExternalAnalysis=*/nullptr,
1270-
/*LookThroughIntToPtr*/ IsEqPred);
1270+
/*LookThroughIntToPtr=*/IsEqPred);
12711271
if (Stripped0 == Stripped1)
12721272
return ConstantInt::getBool(
12731273
Ops0->getContext(),

llvm/lib/IR/Value.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,7 @@ const Value *Value::stripAndAccumulateConstantOffsets(
792792
if (!Ptr2Int || !CI)
793793
return V;
794794

795-
const APInt &AddOffset = CI->getValue();
796-
Offset += AddOffset;
795+
Offset += CI->getValue();
797796
V = Ptr2Int->getOperand(0);
798797
}
799798
assert(V->getType()->isPtrOrPtrVectorTy() && "Unexpected operand type!");

llvm/test/Transforms/InstSimplify/constant-fold-inttoptr-add.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2-
; RUN: opt -p instcombine -S %s | FileCheck %s
2+
; RUN: opt -p instsimplify -S %s | FileCheck %s
33

44
@glob = external global [314 x i64]
55

@@ -15,7 +15,7 @@ define i1 @known_constexpr_add_eq_ops_swapped() {
1515
; CHECK-LABEL: define i1 @known_constexpr_add_eq_ops_swapped() {
1616
; CHECK-NEXT: ret i1 false
1717
;
18-
%cond = icmp eq ptr getelementptr inbounds nuw (i8, ptr @glob, i64 80), inttoptr (i64 add (i64 ptrtoint (ptr @glob to i64), i64 -80) to ptr)
18+
%cond = icmp eq ptr inttoptr (i64 add (i64 ptrtoint (ptr @glob to i64), i64 -80) to ptr), getelementptr inbounds nuw (i8, ptr @glob, i64 80)
1919
ret i1 %cond
2020
}
2121

0 commit comments

Comments
 (0)