[llvm] r340432 - [CodeGenPrepare] Set debug locs when folding a comparison into a uadd.with.overflow
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 11:15:04 PDT 2018
Author: vedantk
Date: Wed Aug 22 11:15:03 2018
New Revision: 340432
URL: http://llvm.org/viewvc/llvm-project?rev=340432&view=rev
Log:
[CodeGenPrepare] Set debug locs when folding a comparison into a uadd.with.overflow
CGP can replace a branch + select with a uadd.with.overflow. Teach it to
set debug locations as it does this.
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
llvm/trunk/test/Transforms/CodeGenPrepare/overflow-intrinsics.ll
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=340432&r1=340431&r2=340432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Wed Aug 22 11:15:03 2018
@@ -1164,11 +1164,15 @@ static bool CombineUAddWithOverflow(CmpI
auto *InsertPt = AddI->hasOneUse() ? CI : AddI;
+ DebugLoc Loc = CI->getDebugLoc();
auto *UAddWithOverflow =
CallInst::Create(F, {A, B}, "uadd.overflow", InsertPt);
+ UAddWithOverflow->setDebugLoc(Loc);
auto *UAdd = ExtractValueInst::Create(UAddWithOverflow, 0, "uadd", InsertPt);
+ UAdd->setDebugLoc(Loc);
auto *Overflow =
ExtractValueInst::Create(UAddWithOverflow, 1, "overflow", InsertPt);
+ Overflow->setDebugLoc(Loc);
CI->replaceAllUsesWith(Overflow);
AddI->replaceAllUsesWith(UAdd);
Modified: llvm/trunk/test/Transforms/CodeGenPrepare/overflow-intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/overflow-intrinsics.ll?rev=340432&r1=340431&r2=340432&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CodeGenPrepare/overflow-intrinsics.ll (original)
+++ llvm/trunk/test/Transforms/CodeGenPrepare/overflow-intrinsics.ll Wed Aug 22 11:15:03 2018
@@ -1,4 +1,5 @@
; RUN: opt -codegenprepare -S < %s | FileCheck %s
+; RUN: opt -enable-debugify -codegenprepare -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
@@ -72,3 +73,6 @@ entry:
exit:
ret i64 0
}
+
+; Check that every instruction inserted by -codegenprepare has a debug location.
+; DEBUG: CheckModuleDebugify: PASS
More information about the llvm-commits
mailing list